title: The Most Complex Chinese Character

text:
# Question
Title: The Most Complex Chinese Character
# Challenge

You must output the Chinese character for biáng. Your program must not access any external sources and must exactly reproduce this SVG in every way. Note that the image below is just a gif version of the image.

The output should be an SVG file. Your program must be a program, therefore you cannot hardcode the SVG.

The shortest code wins.

---

Just in case Wikipedia goes down or changes the file, here's the SVG file you are required to output.

```
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="svg2" xmlns:svg="http://www.w3.org/2000/svg"
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="500px" height="500px"
     viewBox="0 0 500 500" enable-background="new 0 0 500 500" xml:space="preserve">
<g>
    <path d="M408.997,122.382l3.629-2.032l-10.012-6.497l-10.009-6.497l-2.195,7.083c-2.958,9.552-8.487,20.773-14.003,28.416
        c-4.355,6.038-13.775,14.106-16.467,14.106c-1.68,0-1.755-0.338,1.861,8.345c1.729,4.151,3.555,8.729,4.06,10.174l0.918,2.628
        l3.079-2.823c1.695-1.553,2.253-3.035,8.304-4.512c6.57-2.126,17.534-4.232,19.088-3.667c0.664,0.242-2.23,5.356-6.649,11.744
        c-7.984,11.543-16.75,20.515-23.942,24.513l-4.021,2.23l2.822,5.478c1.553,3.012,3.536,6.505,4.409,7.765
        c1.581,2.29,1.583,2.29,5.064,0.121c4.438-2.765,10.479-4.206,26.281-6.271c6.966-0.912,14.321-1.902,16.349-2.202
        c3.173-0.472,3.769-0.204,4.293,1.928c0.602,3.25,0.421,6.658,1.686,9.72c1.433,2.916,2.298,2.712,6.408-1.512
        c6.831-7.014,5.967-13.847-3.337-26.405c-8.965-12.096-10.583-13.513-14.101-12.321l-2.938,0.995l4.938,9.333
        c2.719,5.134,4.939,9.727,4.939,10.207c-11.883,3.042-30.03,1.979-40.493-0.616c11.232-11.183,22.685-22.159,32.729-34.656
        c4.926-6.111,10.282-11.712,11.905-12.445c1.625-0.731,2.952-1.666,2.952-2.075c0-1.163-13.91-14.435-15.127-14.435
        c-0.598,0-1.084,0.441-1.084,0.98c0,0.54-1.685,5.007-3.74,9.931l-3.743,8.95h-15.509c-8.531,0-15.511-0.396-15.511-0.879
        C371.832,155.722,405.104,124.561,408.997,122.382z"/>
    <path d="M258.98,130.742c0.053,0.014,1.647-0.792,3.545-1.79c7.975-3.285-2.358-2.285,55.517-2.333l52.069-0.518l-10.669-10.107
        c-5.87-5.56-11.147-10.108-11.729-10.108s-5.587,2.333-11.124,5.184c-9.552,4.919-10.469,5.183-18.048,5.167l-7.983-0.018
        l3.958-2.316c2.174-1.272,4.808-3.489,5.847-4.924c5.623-7.761-5.982-19.346-28.117-28.067c-8.884-3.5-9.777-3.59-13.149-1.33
        l-2.516,1.685l8.925,8.95c4.908,4.921,10.896,11.744,13.305,15.16c2.41,3.415,5.583,7.258,7.053,8.539l2.671,2.327l-65.431,0.01
        L258.98,130.742z"/>
    <path d="M186.128,315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.062,57.187,0.062,57.187l3.226,4.437l3.226,4.436
        l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.891-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818
        c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.406,4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899
        c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059
        c0-1.607,8.525-6.173,15.958-8.546c2.368-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304
        c-2.329,4.018-5.628,8.578-7.331,10.139c-3.63,3.326-3.103,3.846-9.879-9.668l-4.288-8.553h21.934
        c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.189,4.654l-15.856-0.304l-15.855-0.305v-15.445l21.001-0.299
        l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.192-4.654l-4.025,5.506h-23.713l0.156-16.187
        c0,0,9.811-0.366,21.283-0.366h20.856l-2.92-4.137c-1.606-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.208-3.035-2.771-3.035
        c-3.22,1.875-5.566,5.064-8.179,7.793l-23.601,0.083l-0.079-16.15l23.023-0.296l23.022-0.297l-5.762-8.254
        c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.691,5.271l-27.793-0.132l-6.333-4.694l-6.333-4.694v78.42
        h-6.791h-6.792l3.884,4.332C183.125,316.086,184.001,316.543,186.128,315.664z M204.417,314.583c0,0,8.866,27.05,12.347,32.667
        c1.747,2.82,3.275,5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C204.395,356.627,204.417,314.583,204.417,314.583z"/>
    <path d="M261.965,181.771c1.221,9.539,1.402,12.767,1.438,25.451c0.021,7.555,0.445,13.736,0.945,13.736l17.965-4.775l46.482-0.927
        l0.329,2.951c0.243,2.176,0.775,2.827,2.026,2.48c17.15-4.759,18.48-5.351,17.973-8.02c-0.273-1.428-0.788-4.786-1.147-7.462
        l-0.65-4.867l5.256-3.307c4.265-2.687,4.999-3.544,3.904-4.574c-5.08-4.773-18.053-15.041-19.002-15.041
        c-0.636,0-3.405,1.167-6.154,2.591c-4.897,2.54-5.468,2.592-28.083,2.591c-21.454,0-30.73-0.863-40.001-3.72
        C261.818,178.44,261.602,178.93,261.965,181.771z M282.587,194.416l46.771-0.173l-0.059,10.129h-46.714L282.587,194.416
        L282.587,194.416z"/>
    <path d="M132.747,117.241c5.765,0,14.563-3.956,18.616-8.368c5.548-6.042,7.219-12.919,7.151-29.423l-0.058-14.067l290.407,0.713
        c-5.424,10.956-12.065,21.715-19.278,31.285c-0.598,0-2.317-0.685-3.823-1.522c-6.836-3.802-53.454-19.196-54.545-18.01
        c-0.255,0.278-0.558,1.815-0.671,3.417c-0.188,2.659,0.501,3.226,8.055,6.619c28.843,12.951,58.013,34.96,66.693,50.322
        c1.543,2.73,3.762,6.105,4.927,7.498c2.953,3.523,6.4,2.758,10.109-2.247c3.724-5.028,4.797-13.614,2.451-19.628
        c-2.584-6.627-9.453-13.933-16.926-18.004l-6.975-3.799l8.284-8.739c15.736-16.604,30.355-25.762,47.054-29.475l5.333-1.186
        L466.338,26.51l-19.287,25.631l-131.934-0.837c0-0.46,0.95-1.485,2.108-2.273c1.162-0.79,3.008-3.638,4.102-6.331
        c2.848-7.014,1.793-11.743-3.981-17.855c-5.167-5.468-21.688-14.674-36.105-20.121c-8.871-3.351-9.092-3.378-10.965-1.339
        c-1.873,2.04-1.717,2.346,7.752,15.212c9.431,12.81,16.824,26.532,16.824,31.215v2.329l-136.913-1.104
        c-0.07-0.606-0.209-1.476-0.309-1.931c-0.747-6.734-1.197-13.502-1.782-20.254l-8.098,0.669l-2.87,12.137
        c-4.672,19.751-12.426,37.031-21.287,47.445c-8.19,9.624-11.13,19.299-7.177,23.606
        C118.529,115.012,126.565,117.241,132.747,117.241z"/>
    <path d="M497.863,453.926c0,0-6.328,1.162-11.621,1.771c-53.488,6.135-95.518,8.235-164.648,8.235
        c-92.593,0-150.715-4.537-186.435-14.549c-21.072-5.908-37.036-18.377-43.876-34.272l-2.732-6.346l-0.556-207.73l8.155-6.395
        c4.486-3.517,8.03-6.792,7.876-7.278c-0.553-1.763-29.472-28.583-30.439-28.232c-0.547,0.199-4.038,5.058-7.757,10.798
        l-6.765,10.436l-28.088,0.552l-28.089,0.551l9.016,9.771l9.016,9.771l8.486-2.245c12.449-3.293,19.834-4.607,25.896-4.607h5.386
        v208.28L0,454.15l27.968,27.782c0.589-0.797,6.647-11.381,13.463-23.516c6.816-12.139,14.04-24.721,16.056-27.961
        c4.235-6.812,10.905-13.735,12.644-13.133c0.658,0.229,6.095,8.291,12.084,17.92c12.337,19.834,13.402,21.227,20.836,27.254
        c22.951,18.607,65.076,28.838,128.873,31.293c74.453,2.68,148.922,4.115,223.418,3.92l1.873-5.76
        c3.664-11.26,17.123-22.103,33.396-26.896l6.779-2v-4.248C497.389,456.469,497.863,453.926,497.863,453.926z"/>
    <path d="M67.377,99.175c3.615,13.117,7.038,20.628,10.361,22.734c4.389,2.782,9.84,0.074,15.801-7.847
        c6.25-8.306,9.067-16.414,9.077-26.118c0.018-20.292-12.427-36.144-44.859-57.137c-7.896-5.112-24.133-14.715-24.878-14.715
        c-1.627,1.909-3.001,4.063-4.373,6.208l5.627,7.655C50.934,52.805,59.531,70.706,67.377,99.175z"/>
    <path d="M173.771,362.742l0.52-190.884l3.063-2.758l3.062-2.759l-7.109-7.678l-7.108-7.678l-3.356,3.542
        c-3.192,3.369-3.737,3.542-11.244,3.542c-6.402,0-9.319-0.623-15.48-3.311c-4.175-1.82-8.006-3.31-8.513-3.31
        c-0.549,0-0.621,11.039-0.176,27.31c0.955,34.97,0.958,91.285,0.006,111.164c-1.267,26.447-4.287,49.291-9.586,72.48
        c-3.079,13.479-3.482,16.498-2.39,17.932c0.721,0.947,1.631,1.721,2.021,1.721c1.117,0,8.793-15.195,12.104-23.961
        c5.931-15.701,10.866-37.443,12.781-56.309l0.701-6.898h17.026l-1.326,55.17c-1.423,3.031-2.515,3.168-13.619,1.717
        c-6.279-0.819-6.333-0.807-6.333,1.927c0,1.928,2.073,5.016,6.923,10.313c4.599,5.021,7.539,9.328,8.759,12.826
        c1.563,4.484,2.151,5.162,3.969,4.582c5.182-1.656,9.604-6.027,12.419-12.273L173.771,362.742z M160.092,286.059h-17.225v-55.169
        h17.225V286.059z M160.092,222.062h-17.225V169.1h17.225V222.062z"/>
    <path d="M293.07,161.867l-28.633,0.519l9.645,13.688l4.053-1.601c9.032-3.139-3.802-2.639,40.807-2.178l36.75-0.577l-9.136-9.302
        l-9.138-9.302l-15.717,8.237L293.07,161.867z"/>
    <path d="M222.14,68.533l-13.546,14.79c-10.902,11.906-16.242,16.731-27.367,24.737c-13.609,9.792-34.075,21.463-47.984,27.362
        c-8.677,3.68-8.933,3.929-7.692,7.482l0.995,2.851l11.961-3.866c26.478-8.556,46.305-17.892,73.013-34.374
        c22.589-13.94,23.673-14.466,32.708-15.858l8.12-1.25l-15.104-10.938L222.14,68.533z"/>
    <path d="M346.897,139.838c-4.937-4.418-9.556-8.035-10.266-8.035c-0.711,0-4.132,1.274-7.604,2.83
        c-6.304,2.824-6.376,2.832-36.464,3.368l-30.149,0.54l9.534,13.669L280.5,149c20.153-0.787,75.367-1.13,75.367-1.13
        L346.897,139.838z"/>
    <path d="M191.97,200.99l-7.131,5.135l3.792,7.141c2.085,3.927,4.154,7.11,4.598,7.071s2.631-0.968,4.859-2.064
        c4.674-2.301,15.125-4.473,32.423-6.736c6.687-0.875,12.5-1.596,12.919-1.602c0.418-0.005,0.76,1.944,0.76,4.333
        s0.445,5.615,0.988,7.172c1.354,3.878,2.733,3.569,7.275-1.629c3.089-3.538,3.895-5.307,3.886-8.552
        c-0.012-5.345-4.213-13.069-12.353-22.718c-6.06-7.182-6.586-7.55-9.729-6.798l-3.324,0.795l2.109,3.488
        c2.306,3.813,8.108,15.761,8.108,16.697c0,0.321-9.46,0.571-21.024,0.557l-21.024-0.027l5.573-5.173
        c9.319-8.649,25.171-25.794,30.967-33.491c3.499-4.647,7.001-8.021,9.703-9.348l4.227-2.077l-7.502-7.476
        c-4.127-4.112-7.962-7.478-8.522-7.478c-0.56-0.001-2.04,2.853-3.289,6.343c-1.25,3.49-3.177,7.958-4.286,9.931l-2.016,3.586
        h-15.214c-8.367,0-15.214-0.389-15.214-0.863c0-1.57,32.485-31.646,36.547-33.836c2.19-1.181,3.977-2.423,3.971-2.758
        c-0.01-0.471-16.511-11.646-19.253-13.038c-0.314-0.159-1.139,2.018-1.831,4.838c-4.399,17.911-17.597,37.768-28.624,43.065
        c-2.208,1.061-3.893,2.242-3.744,2.625c0.147,0.384,2.041,4.976,4.206,10.205l3.936,9.507l3.157-2.587
        c1.735-1.424,1.981-2.978,7.862-4.304c5.551-2.023,17.526-4.417,19.151-3.827c1.393,0.506-8.597,15.994-15.084,23.384
        C201.226,193.434,195.893,198.165,191.97,200.99z"/>
    <g>
        <path d="M212.273,453.381c3.344,0.342,48.484,0.586,100.309,0.541c104.205-0.092,103.413-0.051,118.041-5.967
            c5.849-2.363,13.173-7.344,13.173-8.955c0-0.326-1.924-1.367-4.281-2.314c-6.762-2.721-13.946-8.301-16.041-12.454
            c-1.045-2.07-2.46-6.722-3.145-10.333l-1.247-6.569h-7.71l-0.052,8.836c-0.064,11.17-0.775,16.463-2.543,18.949
            c-0.769,1.08-3.727,3.758-7.037,3.852c-75.582,2.135-45.149,2.668-178.322,1.857l-3.958-2.023
            c-7.031-3.596-8.162-5.832-8.495-16.811l-0.294-9.677l7.403-9.295c-0.404-0.127-7.347-2.629-15.428-5.555l-14.692-5.318
            l-0.294,17.783c-0.404,24.496,0.977,30.943,7.974,37.199C199.686,450.748,204.608,452.6,212.273,453.381z"/>
        <path d="M154.256,404.033c-8.408,11.227-12.161,14.928-23.174,22.85c-9.769,7.023-12.531,9.717-12.531,12.219
            c0,2.013,2.844,4.125,7.092,5.271c5.889,1.586,15.512,0.643,20.592-2.021c11.565-6.061,17.982-18.053,19.518-36.479l0.688-8.248
            l-2.993-0.937C160.487,395.766,160.388,395.846,154.256,404.033z"/>
        <path d="M467.429,427.342c7.128,6.679,13.961,12.64,15.182,13.246c2.935,1.459,3.889,1.433,6.477-0.188
            c4.783-2.996,7.222-17.277,3.925-22.98c-2.907-5.024-19.268-12.119-49.51-21.471l-6.883-2.13l-1.896,2.789l-1.896,2.789
            l10.818,7.902C449.596,411.645,460.298,420.664,467.429,427.342z"/>
        <path d="M269.754,387.078c23.155,8.477,43.153,21.201,61.019,38.826c4.429,4.369,9.442,8.715,11.146,9.653
            c5.188,2.869,9.702,1.068,12.854-5.127c3.214-6.315,1.988-12.452-3.85-19.299c-7.554-8.856-35.523-19.508-81.013-30.853
            c-5.78-1.442-6.18-1.364-7.217,1.421C261.796,384.111,261.941,384.221,269.754,387.078z"/>
    </g>
    <g>
        <path d="M467.412,353.047c-2.155,3.582-4.95,3.83-15.26,1.361c-8.745-2.096-8.292-2.172-8.292,1.41
            c0.002,2.524,0.918,3.666,4.922,6.123c7.375,4.526,13.388,10.608,15.398,15.578l1.795,4.434l3.04-1.924
            c4.878-3.088,12.663-13.078,14.016-17.979c0.923-3.36,1.241-28.937,1.241-99.608c0-94.833,0.008-95.104,2.189-98.953
            c1.205-2.123,2.022-4.032,1.813-4.239c-1.136-1.142-19.828-13.102-20.033-12.818c0.024,38.464,2.318,76.997,1.136,115.494
            C469.258,344.197,469.128,350.195,467.412,353.047z"/>
        <path d="M460.258,187.415c-0.833-0.828-19.634-12.998-20.08-12.998c-0.276,0-0.206,1.396,0.158,3.104
            c0.88,4.141,0.673,134.569,0.673,134.569l-1.222,13.625l4.368-2.914c2.401-1.604,6.139-4.033,8.304-5.404
            c3.392-2.143,3.833-2.873,3.206-5.307c-2.539-38.09-0.279-76.467-1.546-114.606l3.234-4.867
            C459.136,189.939,460.443,187.599,460.258,187.415z"/>
    </g>
    <g>
        <path d="M324.872,336.477c0.914,3.049,2.071,6.414,2.574,7.476c0.503,1.063,1.563,1.934,2.354,1.934
            c1.909,0,6.542-8.731,7.288-13.739c0.53-3.578,0.188-4.396-3.511-8.222c-7.599-7.87-18.464-13.133-18.464-8.938
            c0,0.475,1.821,4.258,4.047,8.406C321.389,327.535,323.957,333.424,324.872,336.477z"/>
        <path d="M305.599,322.059c-4.9-3.918-6.319-4.567-7.93-3.629c-1.078,0.629-1.729,1.725-1.446,2.437
            c5.487,13.84,7.747,19.838,7.747,20.557c0,0.486,0.688,2.681,1.534,4.879c0.843,2.197,2.206,3.996,3.025,3.996
            c2.134,0,6.729-8.422,7.35-13.467C316.503,331.787,314.914,329.504,305.599,322.059z"/>
        <path d="M267.803,322.389l-2.938,0.803c-1.614,0.443-2.983,0.89-3.041,0.99c-0.06,0.103-1.337,3.164-2.841,6.805
            c-1.502,3.642-5.028,10.438-7.834,15.105c-2.808,4.664-4.946,9.367-4.754,10.451c0.192,1.086,1.484,2.6,2.874,3.363
            c3.453,1.902,5.027,1.771,8.807-0.736c5.485-3.646,8.052-11.264,9.083-26.965L267.803,322.389z"/>
        <path d="M292.098,349.443c5.434-10.875,4.582-14.133-6.117-23.508c-6.394-5.601-7.758-6.367-9.508-5.349
            c-1.121,0.654-1.82,1.772-1.552,2.483c0.871,2.291,7.397,20.984,9.218,26.396C286.454,356.352,288.646,356.346,292.098,349.443z"
            />
        <path d="M358.401,313.439c0.123-1.76,1.138-4.265,2.258-5.562l2.036-2.36l-7.324-6.765l-7.323-6.762l-6.177,6.446h-29.793v-8.83
            h37.606l-5.834-7.723c-3.209-4.248-6.22-7.723-6.688-7.723c-0.467,0-2.638,0.994-4.822,2.205
            c-6.396,3.053-13.453,2.074-20.265,2.207v-9.93h37.669l-8.936-11.33l-3.434-4.158l-4.488,2.227
            c-3.313,1.645-6.624,2.227-12.65,2.227h-8.161v-9.929h23.938h23.941l-10.257-8.925l-10.26-8.924l-5.087,3.407l-5.085,3.409
            h-28.884h-28.885l-6.724-3.319c-3.697-1.827-6.853-3.181-7.01-3.009c-0.158,0.172,0.092,4.273,0.555,9.113
            c1.08,11.3,1.058,51.577-0.039,67.229c-0.467,6.647-0.75,12.157-0.631,12.248c0.119,0.088,4.18-0.32,9.025-0.906l8.811-1.063
            l0.31-3.459l0.31-3.457h32.93h32.93l-0.027,11.033c-0.035,14.659-2.152,22.293-7.934,28.588
            c-5.641,6.143-10.338,7.366-28.119,7.342c-7.742-0.01-14.074,0.404-14.074,0.924c0,1.494,2.207,2.934,6.586,4.293
            c7.826,2.428,15.965,9.639,17.98,15.93c0.399,1.252,9.794-1.801,15.963-5.188c8.899-4.885,15.709-11.869,19.164-19.662
            c2.923-6.592,6.166-20.684,6.166-26.797C357.673,324.498,358.316,314.664,358.401,313.439z M275.777,251.361l0.33-3.128h21.277
            v8.828l-10.402,0.314C275.643,257.719,275.139,257.449,275.777,251.361z M297.893,298.439h-22.291v-8.83h22.291V298.439z
             M297.386,278.023l-21.075-0.148c-0.968-2.947-0.68-6.131-0.709-9.23h22.408L297.386,278.023z"/>
    </g>
    <path d="M365.116,315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.063,57.187,0.063,57.187l3.227,4.437l3.226,4.436
        l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.892-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818
        c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.405,4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899
        c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059
        c0-1.607,8.525-6.173,15.959-8.546c2.367-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304
        c-2.328,4.018-5.628,8.578-7.33,10.139c-3.631,3.326-3.104,3.846-9.88-9.668l-4.288-8.553h21.935
        c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.188,4.654l-15.856-0.304l-15.854-0.305v-15.445l21.001-0.299
        l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.191-4.654l-4.025,5.506h-23.713l0.156-16.187
        c0,0,9.811-0.366,21.283-0.366h20.855l-2.92-4.137c-1.605-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.207-3.035-2.771-3.035
        c-3.22,1.875-5.566,5.064-8.179,7.793l-23.602,0.083l-0.079-16.15l23.022-0.296l23.022-0.297l-5.762-8.254
        c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.69,5.271l-27.793-0.132l-6.334-4.694l-6.332-4.694v78.42
        h-6.791h-6.793l3.885,4.332C362.113,316.086,362.989,316.543,365.116,315.664z M383.404,314.583c0,0,8.866,27.05,12.348,32.667
        c1.746,2.82,3.274,5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C383.383,356.627,383.404,314.583,383.404,314.583z"/>
</g>
</svg>

```

# Answer
# PHP - 8559 bytes

```
<?=bzdecompress(base64_decode('[encoded data, 8524 characters]'));

```
> 5 votes

# Answer
# perl 17055

```
print '<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="svg2" xmlns:svg="http://www.w3.org/2000/svg"
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="500px" height="500px"
     viewBox="0 0 500 500" enable-background="new 0 0 500 500" xml:space="preserve">
<g>
    <path d="M408.997,122.382l3.629-2.032l-10.012-6.497l-10.009-6.497l-2.195,7.083c-2.958,9.552-8.487,20.773-14.003,28.416
        c-4.355,6.038-13.775,14.106-16.467,14.106c-1.68,0-1.755-0.338,1.861,8.345c1.729,4.151,3.555,8.729,4.06,10.174l0.918,2.628
        l3.079-2.823c1.695-1.553,2.253-3.035,8.304-4.512c6.57-2.126,17.534-4.232,19.088-3.667c0.664,0.242-2.23,5.356-6.649,11.744
        c-7.984,11.543-16.75,20.515-23.942,24.513l-4.021,2.23l2.822,5.478c1.553,3.012,3.536,6.505,4.409,7.765
        c1.581,2.29,1.583,2.29,5.064,0.121c4.438-2.765,10.479-4.206,26.281-6.271c6.966-0.912,14.321-1.902,16.349-2.202
        c3.173-0.472,3.769-0.204,4.293,1.928c0.602,3.25,0.421,6.658,1.686,9.72c1.433,2.916,2.298,2.712,6.408-1.512
        c6.831-7.014,5.967-13.847-3.337-26.405c-8.965-12.096-10.583-13.513-14.101-12.321l-2.938,0.995l4.938,9.333
        c2.719,5.134,4.939,9.727,4.939,10.207c-11.883,3.042-30.03,1.979-40.493-0.616c11.232-11.183,22.685-22.159,32.729-34.656
        c4.926-6.111,10.282-11.712,11.905-12.445c1.625-0.731,2.952-1.666,2.952-2.075c0-1.163-13.91-14.435-15.127-14.435
        c-0.598,0-1.084,0.441-1.084,0.98c0,0.54-1.685,5.007-3.74,9.931l-3.743,8.95h-15.509c-8.531,0-15.511-0.396-15.511-0.879
        C371.832,155.722,405.104,124.561,408.997,122.382z"/>
    <path d="M258.98,130.742c0.053,0.014,1.647-0.792,3.545-1.79c7.975-3.285-2.358-2.285,55.517-2.333l52.069-0.518l-10.669-10.107
        c-5.87-5.56-11.147-10.108-11.729-10.108s-5.587,2.333-11.124,5.184c-9.552,4.919-10.469,5.183-18.048,5.167l-7.983-0.018
        l3.958-2.316c2.174-1.272,4.808-3.489,5.847-4.924c5.623-7.761-5.982-19.346-28.117-28.067c-8.884-3.5-9.777-3.59-13.149-1.33
        l-2.516,1.685l8.925,8.95c4.908,4.921,10.896,11.744,13.305,15.16c2.41,3.415,5.583,7.258,7.053,8.539l2.671,2.327l-65.431,0.01
        L258.98,130.742z"/>
    <path d="M186.128,315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.062,57.187,0.062,57.187l3.226,4.437l3.226,4.436
        l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.891-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818
        c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.406,4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899
        c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059
        c0-1.607,8.525-6.173,15.958-8.546c2.368-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304
        c-2.329,4.018-5.628,8.578-7.331,10.139c-3.63,3.326-3.103,3.846-9.879-9.668l-4.288-8.553h21.934
        c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.189,4.654l-15.856-0.304l-15.855-0.305v-15.445l21.001-0.299
        l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.192-4.654l-4.025,5.506h-23.713l0.156-16.187
        c0,0,9.811-0.366,21.283-0.366h20.856l-2.92-4.137c-1.606-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.208-3.035-2.771-3.035
        c-3.22,1.875-5.566,5.064-8.179,7.793l-23.601,0.083l-0.079-16.15l23.023-0.296l23.022-0.297l-5.762-8.254
        c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.691,5.271l-27.793-0.132l-6.333-4.694l-6.333-4.694v78.42
        h-6.791h-6.792l3.884,4.332C183.125,316.086,184.001,316.543,186.128,315.664z M204.417,314.583c0,0,8.866,27.05,12.347,32.667
        c1.747,2.82,3.275,5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C204.395,356.627,204.417,314.583,204.417,314.583z"/>
    <path d="M261.965,181.771c1.221,9.539,1.402,12.767,1.438,25.451c0.021,7.555,0.445,13.736,0.945,13.736l17.965-4.775l46.482-0.927
        l0.329,2.951c0.243,2.176,0.775,2.827,2.026,2.48c17.15-4.759,18.48-5.351,17.973-8.02c-0.273-1.428-0.788-4.786-1.147-7.462
        l-0.65-4.867l5.256-3.307c4.265-2.687,4.999-3.544,3.904-4.574c-5.08-4.773-18.053-15.041-19.002-15.041
        c-0.636,0-3.405,1.167-6.154,2.591c-4.897,2.54-5.468,2.592-28.083,2.591c-21.454,0-30.73-0.863-40.001-3.72
        C261.818,178.44,261.602,178.93,261.965,181.771z M282.587,194.416l46.771-0.173l-0.059,10.129h-46.714L282.587,194.416
        L282.587,194.416z"/>
    <path d="M132.747,117.241c5.765,0,14.563-3.956,18.616-8.368c5.548-6.042,7.219-12.919,7.151-29.423l-0.058-14.067l290.407,0.713
        c-5.424,10.956-12.065,21.715-19.278,31.285c-0.598,0-2.317-0.685-3.823-1.522c-6.836-3.802-53.454-19.196-54.545-18.01
        c-0.255,0.278-0.558,1.815-0.671,3.417c-0.188,2.659,0.501,3.226,8.055,6.619c28.843,12.951,58.013,34.96,66.693,50.322
        c1.543,2.73,3.762,6.105,4.927,7.498c2.953,3.523,6.4,2.758,10.109-2.247c3.724-5.028,4.797-13.614,2.451-19.628
        c-2.584-6.627-9.453-13.933-16.926-18.004l-6.975-3.799l8.284-8.739c15.736-16.604,30.355-25.762,47.054-29.475l5.333-1.186
        L466.338,26.51l-19.287,25.631l-131.934-0.837c0-0.46,0.95-1.485,2.108-2.273c1.162-0.79,3.008-3.638,4.102-6.331
        c2.848-7.014,1.793-11.743-3.981-17.855c-5.167-5.468-21.688-14.674-36.105-20.121c-8.871-3.351-9.092-3.378-10.965-1.339
        c-1.873,2.04-1.717,2.346,7.752,15.212c9.431,12.81,16.824,26.532,16.824,31.215v2.329l-136.913-1.104
        c-0.07-0.606-0.209-1.476-0.309-1.931c-0.747-6.734-1.197-13.502-1.782-20.254l-8.098,0.669l-2.87,12.137
        c-4.672,19.751-12.426,37.031-21.287,47.445c-8.19,9.624-11.13,19.299-7.177,23.606
        C118.529,115.012,126.565,117.241,132.747,117.241z"/>
    <path d="M497.863,453.926c0,0-6.328,1.162-11.621,1.771c-53.488,6.135-95.518,8.235-164.648,8.235
        c-92.593,0-150.715-4.537-186.435-14.549c-21.072-5.908-37.036-18.377-43.876-34.272l-2.732-6.346l-0.556-207.73l8.155-6.395
        c4.486-3.517,8.03-6.792,7.876-7.278c-0.553-1.763-29.472-28.583-30.439-28.232c-0.547,0.199-4.038,5.058-7.757,10.798
        l-6.765,10.436l-28.088,0.552l-28.089,0.551l9.016,9.771l9.016,9.771l8.486-2.245c12.449-3.293,19.834-4.607,25.896-4.607h5.386
        v208.28L0,454.15l27.968,27.782c0.589-0.797,6.647-11.381,13.463-23.516c6.816-12.139,14.04-24.721,16.056-27.961
        c4.235-6.812,10.905-13.735,12.644-13.133c0.658,0.229,6.095,8.291,12.084,17.92c12.337,19.834,13.402,21.227,20.836,27.254
        c22.951,18.607,65.076,28.838,128.873,31.293c74.453,2.68,148.922,4.115,223.418,3.92l1.873-5.76
        c3.664-11.26,17.123-22.103,33.396-26.896l6.779-2v-4.248C497.389,456.469,497.863,453.926,497.863,453.926z"/>
    <path d="M67.377,99.175c3.615,13.117,7.038,20.628,10.361,22.734c4.389,2.782,9.84,0.074,15.801-7.847
        c6.25-8.306,9.067-16.414,9.077-26.118c0.018-20.292-12.427-36.144-44.859-57.137c-7.896-5.112-24.133-14.715-24.878-14.715
        c-1.627,1.909-3.001,4.063-4.373,6.208l5.627,7.655C50.934,52.805,59.531,70.706,67.377,99.175z"/>
    <path d="M173.771,362.742l0.52-190.884l3.063-2.758l3.062-2.759l-7.109-7.678l-7.108-7.678l-3.356,3.542
        c-3.192,3.369-3.737,3.542-11.244,3.542c-6.402,0-9.319-0.623-15.48-3.311c-4.175-1.82-8.006-3.31-8.513-3.31
        c-0.549,0-0.621,11.039-0.176,27.31c0.955,34.97,0.958,91.285,0.006,111.164c-1.267,26.447-4.287,49.291-9.586,72.48
        c-3.079,13.479-3.482,16.498-2.39,17.932c0.721,0.947,1.631,1.721,2.021,1.721c1.117,0,8.793-15.195,12.104-23.961
        c5.931-15.701,10.866-37.443,12.781-56.309l0.701-6.898h17.026l-1.326,55.17c-1.423,3.031-2.515,3.168-13.619,1.717
        c-6.279-0.819-6.333-0.807-6.333,1.927c0,1.928,2.073,5.016,6.923,10.313c4.599,5.021,7.539,9.328,8.759,12.826
        c1.563,4.484,2.151,5.162,3.969,4.582c5.182-1.656,9.604-6.027,12.419-12.273L173.771,362.742z M160.092,286.059h-17.225v-55.169
        h17.225V286.059z M160.092,222.062h-17.225V169.1h17.225V222.062z"/>
    <path d="M293.07,161.867l-28.633,0.519l9.645,13.688l4.053-1.601c9.032-3.139-3.802-2.639,40.807-2.178l36.75-0.577l-9.136-9.302
        l-9.138-9.302l-15.717,8.237L293.07,161.867z"/>
    <path d="M222.14,68.533l-13.546,14.79c-10.902,11.906-16.242,16.731-27.367,24.737c-13.609,9.792-34.075,21.463-47.984,27.362
        c-8.677,3.68-8.933,3.929-7.692,7.482l0.995,2.851l11.961-3.866c26.478-8.556,46.305-17.892,73.013-34.374
        c22.589-13.94,23.673-14.466,32.708-15.858l8.12-1.25l-15.104-10.938L222.14,68.533z"/>
    <path d="M346.897,139.838c-4.937-4.418-9.556-8.035-10.266-8.035c-0.711,0-4.132,1.274-7.604,2.83
        c-6.304,2.824-6.376,2.832-36.464,3.368l-30.149,0.54l9.534,13.669L280.5,149c20.153-0.787,75.367-1.13,75.367-1.13
        L346.897,139.838z"/>
    <path d="M191.97,200.99l-7.131,5.135l3.792,7.141c2.085,3.927,4.154,7.11,4.598,7.071s2.631-0.968,4.859-2.064
        c4.674-2.301,15.125-4.473,32.423-6.736c6.687-0.875,12.5-1.596,12.919-1.602c0.418-0.005,0.76,1.944,0.76,4.333
        s0.445,5.615,0.988,7.172c1.354,3.878,2.733,3.569,7.275-1.629c3.089-3.538,3.895-5.307,3.886-8.552
        c-0.012-5.345-4.213-13.069-12.353-22.718c-6.06-7.182-6.586-7.55-9.729-6.798l-3.324,0.795l2.109,3.488
        c2.306,3.813,8.108,15.761,8.108,16.697c0,0.321-9.46,0.571-21.024,0.557l-21.024-0.027l5.573-5.173
        c9.319-8.649,25.171-25.794,30.967-33.491c3.499-4.647,7.001-8.021,9.703-9.348l4.227-2.077l-7.502-7.476
        c-4.127-4.112-7.962-7.478-8.522-7.478c-0.56-0.001-2.04,2.853-3.289,6.343c-1.25,3.49-3.177,7.958-4.286,9.931l-2.016,3.586
        h-15.214c-8.367,0-15.214-0.389-15.214-0.863c0-1.57,32.485-31.646,36.547-33.836c2.19-1.181,3.977-2.423,3.971-2.758
        c-0.01-0.471-16.511-11.646-19.253-13.038c-0.314-0.159-1.139,2.018-1.831,4.838c-4.399,17.911-17.597,37.768-28.624,43.065
        c-2.208,1.061-3.893,2.242-3.744,2.625c0.147,0.384,2.041,4.976,4.206,10.205l3.936,9.507l3.157-2.587
        c1.735-1.424,1.981-2.978,7.862-4.304c5.551-2.023,17.526-4.417,19.151-3.827c1.393,0.506-8.597,15.994-15.084,23.384
        C201.226,193.434,195.893,198.165,191.97,200.99z"/>
    <g>
        <path d="M212.273,453.381c3.344,0.342,48.484,0.586,100.309,0.541c104.205-0.092,103.413-0.051,118.041-5.967
            c5.849-2.363,13.173-7.344,13.173-8.955c0-0.326-1.924-1.367-4.281-2.314c-6.762-2.721-13.946-8.301-16.041-12.454
            c-1.045-2.07-2.46-6.722-3.145-10.333l-1.247-6.569h-7.71l-0.052,8.836c-0.064,11.17-0.775,16.463-2.543,18.949
            c-0.769,1.08-3.727,3.758-7.037,3.852c-75.582,2.135-45.149,2.668-178.322,1.857l-3.958-2.023
            c-7.031-3.596-8.162-5.832-8.495-16.811l-0.294-9.677l7.403-9.295c-0.404-0.127-7.347-2.629-15.428-5.555l-14.692-5.318
            l-0.294,17.783c-0.404,24.496,0.977,30.943,7.974,37.199C199.686,450.748,204.608,452.6,212.273,453.381z"/>
        <path d="M154.256,404.033c-8.408,11.227-12.161,14.928-23.174,22.85c-9.769,7.023-12.531,9.717-12.531,12.219
            c0,2.013,2.844,4.125,7.092,5.271c5.889,1.586,15.512,0.643,20.592-2.021c11.565-6.061,17.982-18.053,19.518-36.479l0.688-8.248
            l-2.993-0.937C160.487,395.766,160.388,395.846,154.256,404.033z"/>
        <path d="M467.429,427.342c7.128,6.679,13.961,12.64,15.182,13.246c2.935,1.459,3.889,1.433,6.477-0.188
            c4.783-2.996,7.222-17.277,3.925-22.98c-2.907-5.024-19.268-12.119-49.51-21.471l-6.883-2.13l-1.896,2.789l-1.896,2.789
            l10.818,7.902C449.596,411.645,460.298,420.664,467.429,427.342z"/>
        <path d="M269.754,387.078c23.155,8.477,43.153,21.201,61.019,38.826c4.429,4.369,9.442,8.715,11.146,9.653
            c5.188,2.869,9.702,1.068,12.854-5.127c3.214-6.315,1.988-12.452-3.85-19.299c-7.554-8.856-35.523-19.508-81.013-30.853
            c-5.78-1.442-6.18-1.364-7.217,1.421C261.796,384.111,261.941,384.221,269.754,387.078z"/>
    </g>
    <g>
        <path d="M467.412,353.047c-2.155,3.582-4.95,3.83-15.26,1.361c-8.745-2.096-8.292-2.172-8.292,1.41
            c0.002,2.524,0.918,3.666,4.922,6.123c7.375,4.526,13.388,10.608,15.398,15.578l1.795,4.434l3.04-1.924
            c4.878-3.088,12.663-13.078,14.016-17.979c0.923-3.36,1.241-28.937,1.241-99.608c0-94.833,0.008-95.104,2.189-98.953
            c1.205-2.123,2.022-4.032,1.813-4.239c-1.136-1.142-19.828-13.102-20.033-12.818c0.024,38.464,2.318,76.997,1.136,115.494
            C469.258,344.197,469.128,350.195,467.412,353.047z"/>
        <path d="M460.258,187.415c-0.833-0.828-19.634-12.998-20.08-12.998c-0.276,0-0.206,1.396,0.158,3.104
            c0.88,4.141,0.673,134.569,0.673,134.569l-1.222,13.625l4.368-2.914c2.401-1.604,6.139-4.033,8.304-5.404
            c3.392-2.143,3.833-2.873,3.206-5.307c-2.539-38.09-0.279-76.467-1.546-114.606l3.234-4.867
            C459.136,189.939,460.443,187.599,460.258,187.415z"/>
    </g>
    <g>
        <path d="M324.872,336.477c0.914,3.049,2.071,6.414,2.574,7.476c0.503,1.063,1.563,1.934,2.354,1.934
            c1.909,0,6.542-8.731,7.288-13.739c0.53-3.578,0.188-4.396-3.511-8.222c-7.599-7.87-18.464-13.133-18.464-8.938
            c0,0.475,1.821,4.258,4.047,8.406C321.389,327.535,323.957,333.424,324.872,336.477z"/>
        <path d="M305.599,322.059c-4.9-3.918-6.319-4.567-7.93-3.629c-1.078,0.629-1.729,1.725-1.446,2.437
            c5.487,13.84,7.747,19.838,7.747,20.557c0,0.486,0.688,2.681,1.534,4.879c0.843,2.197,2.206,3.996,3.025,3.996
            c2.134,0,6.729-8.422,7.35-13.467C316.503,331.787,314.914,329.504,305.599,322.059z"/>
        <path d="M267.803,322.389l-2.938,0.803c-1.614,0.443-2.983,0.89-3.041,0.99c-0.06,0.103-1.337,3.164-2.841,6.805
            c-1.502,3.642-5.028,10.438-7.834,15.105c-2.808,4.664-4.946,9.367-4.754,10.451c0.192,1.086,1.484,2.6,2.874,3.363
            c3.453,1.902,5.027,1.771,8.807-0.736c5.485-3.646,8.052-11.264,9.083-26.965L267.803,322.389z"/>
        <path d="M292.098,349.443c5.434-10.875,4.582-14.133-6.117-23.508c-6.394-5.601-7.758-6.367-9.508-5.349
            c-1.121,0.654-1.82,1.772-1.552,2.483c0.871,2.291,7.397,20.984,9.218,26.396C286.454,356.352,288.646,356.346,292.098,349.443z"
            />
        <path d="M358.401,313.439c0.123-1.76,1.138-4.265,2.258-5.562l2.036-2.36l-7.324-6.765l-7.323-6.762l-6.177,6.446h-29.793v-8.83
            h37.606l-5.834-7.723c-3.209-4.248-6.22-7.723-6.688-7.723c-0.467,0-2.638,0.994-4.822,2.205
            c-6.396,3.053-13.453,2.074-20.265,2.207v-9.93h37.669l-8.936-11.33l-3.434-4.158l-4.488,2.227
            c-3.313,1.645-6.624,2.227-12.65,2.227h-8.161v-9.929h23.938h23.941l-10.257-8.925l-10.26-8.924l-5.087,3.407l-5.085,3.409
            h-28.884h-28.885l-6.724-3.319c-3.697-1.827-6.853-3.181-7.01-3.009c-0.158,0.172,0.092,4.273,0.555,9.113
            c1.08,11.3,1.058,51.577-0.039,67.229c-0.467,6.647-0.75,12.157-0.631,12.248c0.119,0.088,4.18-0.32,9.025-0.906l8.811-1.063
            l0.31-3.459l0.31-3.457h32.93h32.93l-0.027,11.033c-0.035,14.659-2.152,22.293-7.934,28.588
            c-5.641,6.143-10.338,7.366-28.119,7.342c-7.742-0.01-14.074,0.404-14.074,0.924c0,1.494,2.207,2.934,6.586,4.293
            c7.826,2.428,15.965,9.639,17.98,15.93c0.399,1.252,9.794-1.801,15.963-5.188c8.899-4.885,15.709-11.869,19.164-19.662
            c2.923-6.592,6.166-20.684,6.166-26.797C357.673,324.498,358.316,314.664,358.401,313.439z M275.777,251.361l0.33-3.128h21.277
            v8.828l-10.402,0.314C275.643,257.719,275.139,257.449,275.777,251.361z M297.893,298.439h-22.291v-8.83h22.291V298.439z
             M297.386,278.023l-21.075-0.148c-0.968-2.947-0.68-6.131-0.709-9.23h22.408L297.386,278.023z"/>
    </g>
    <path d="M365.116,315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.063,57.187,0.063,57.187l3.227,4.437l3.226,4.436
        l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.892-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818
        c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.405,4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899
        c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059
        c0-1.607,8.525-6.173,15.959-8.546c2.367-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304
        c-2.328,4.018-5.628,8.578-7.33,10.139c-3.631,3.326-3.104,3.846-9.88-9.668l-4.288-8.553h21.935
        c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.188,4.654l-15.856-0.304l-15.854-0.305v-15.445l21.001-0.299
        l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.191-4.654l-4.025,5.506h-23.713l0.156-16.187
        c0,0,9.811-0.366,21.283-0.366h20.855l-2.92-4.137c-1.605-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.207-3.035-2.771-3.035
        c-3.22,1.875-5.566,5.064-8.179,7.793l-23.602,0.083l-0.079-16.15l23.022-0.296l23.022-0.297l-5.762-8.254
        c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.69,5.271l-27.793-0.132l-6.334-4.694l-6.332-4.694v78.42
        h-6.791h-6.793l3.885,4.332C362.113,316.086,362.989,316.543,365.116,315.664z M383.404,314.583c0,0,8.866,27.05,12.348,32.667
        c1.746,2.82,3.274,5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C383.383,356.627,383.404,314.583,383.404,314.583z"/>
</g>
</svg>'

```

kolmogorov who?
> 8 votes

# Answer
# HTML/JavaScript 14184 Bytes

Using \[Obfuscatweet\] we can get 7146 chars! (http://xem.github.io/obfuscatweet/):

```
document.write(unescape(escape('').replace(/uD./g,'')))

```

### Original HTML/JS

Demo

Original HTML is ~~15039~~ 14182 ~~and pushes me over the size limit~~. The entire SVG has been reduced in complexity using parsing and substring searches replaced with the letters D and so on.

```
<script>
function d(a){document.write(a)};
function r(a,b,c){return a.replace(b,c)};
D='<g>';
E='</g>';
F='"/>';
G='<path d="M';
H=',4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059c0-1.607,8.525-6.173,15.95';
I='-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.40';
J='-0.296l23.022-0.297l-5.762-8.254c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.69';
K='-0.305v-15.445l21.001-0.299l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.19';
N='-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304c-2.32';
O=',4.437l3.226,4.436l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.89';
P='-4.654l-4.025,5.506h-23.713l0.156-16.187c0,0,9.811-0.366,21.283-0.366h20.85';
Q='c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.18';
R=',315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.06';
S='-3.035-2.771-3.035c-3.22,1.875-5.566,5.064-8.179,7.793l-23.60';
T=',5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C';
U='-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.20';
W=',314.583c0,0,8.866,27.05,12.34';
X=',4.654l-15.856-0.304l-15.85';
Y=',5.271l-27.793-0.132l-6.33';
d('<svg width="500" height="500">'+D);
d(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r('DG408.997,122.382l3.629-2.032l-10.012-6.497l-10.009-6.497l-2.195,7.083c-2.958,9.552-8.487,20.773-14.003,28.416c-4.355,6.038-13.775,14.106-16.467,14.106c-1.68,0-1.755-0.338,1.861,8.345c1.729,4.151,3.555,8.729,4.06,10.174l0.918,2.628l3.079-2.823c1.695-1.553,2.253-3.035,8.304-4.512c6.57-2.126,17.534-4.232,19.088-3.667c0.664,0.242-2.23,5.356-6.649,11.744c-7.984,11.543-16.75,20.515-23.942,24.513l-4.021,2.23l2.822,5.478c1.553,3.012,3.536,6.505,4.409,7.765c1.581,2.29,1.583,2.29,5.064,0.121c4.438-2.765,10.479-4.206,26.281-6.271c6.966-0.912,14.321-1.902,16.349-2.202c3.173-0.472,3.769-0.204,4.293,1.928c0.602,3.25,0.421,6.658,1.686,9.72c1.433,2.916,2.298,2.712,6.408-1.512c6.831-7.014,5.967-13.847-3.337-26.405c-8.965-12.096-10.583-13.513-14.101-12.321l-2.938,0.995l4.938,9.333c2.719,5.134,4.939,9.727,4.939,10.207c-11.883,3.042-30.03,1.979-40.493-0.616c11.232-11.183,22.685-22.159,32.729-34.656c4.926-6.111,10.282-11.712,11.905-12.445c1.625-0.731,2.952-1.666,2.952-2.075c0-1.163-13.91-14.435-15.127-14.435c-0.598,0-1.084,0.441-1.084,0.98c0,0.54-1.685,5.007-3.74,9.931l-3.743,8.95h-15.509c-8.531,0-15.511-0.396-15.511-0.879C371.832,155.722,405.104,124.561,408.997,122.382zFG258.98,130.742c0.053,0.014,1.647-0.792,3.545-1.79c7.975-3.285-2.358-2.285,55.517-2.333l52.069-0.518l-10.669-10.107c-5.87-5.56-11.147-10.108-11.729-10.108s-5.587,2.333-11.124,5.184c-9.552,4.919-10.469,5.183-18.048,5.167l-7.983-0.018l3.958-2.316c2.174-1.272,4.808-3.489,5.847-4.924c5.623-7.761-5.982-19.346-28.117-28.067c-8.884-3.5-9.777-3.59-13.149-1.33l-2.516,1.685l8.925,8.95c4.908,4.921,10.896,11.744,13.305,15.16c2.41,3.415,5.583,7.258,7.053,8.539l2.671,2.327l-65.431,0.01L258.98,130.742zFG186.128R2,57.187,0.062,57.187l3.226O1I6H8-8.546c2.368N9,4.018-5.628,8.578-7.331,10.139c-3.63,3.326-3.103,3.846-9.879-9.668l-4.288-8.553h21.934Q9X5K2P6l-2.92-4.137c-1.606U8S1,0.083l-0.079-16.15l23.023J1Y3-4.694l-6.333-4.694v78.42h-6.791h-6.792l3.884,4.332C183.125,316.086,184.001,316.543,186.128,315.664z M204.417W7,32.667c1.747,2.82,3.275T204.395,356.627,204.417,314.583,204.417,314.583zFG261.965,181.771c1.221,9.539,1.402,12.767,1.438,25.451c0.021,7.555,0.445,13.736,0.945,13.736l17.965-4.775l46.482-0.927l0.329,2.951c0.243,2.176,0.775,2.827,2.026,2.48c17.15-4.759,18.48-5.351,17.973-8.02c-0.273-1.428-0.788-4.786-1.147-7.462l-0.65-4.867l5.256-3.307c4.265-2.687,4.999-3.544,3.904-4.574c-5.08-4.773-18.053-15.041-19.002-15.041c-0.636,0-3.405,1.167-6.154,2.591c-4.897,2.54-5.468,2.592-28.083,2.591c-21.454,0-30.73-0.863-40.001-3.72C261.818,178.44,261.602,178.93,261.965,181.771z M282.587,194.416l46.771-0.173l-0.059,10.129h-46.714L282.587,194.416L282.587,194.416zFG132.747,117.241c5.765,0,14.563-3.956,18.616-8.368c5.548-6.042,7.219-12.919,7.151-29.423l-0.058-14.067l290.407,0.713c-5.424,10.956-12.065,21.715-19.278,31.285c-0.598,0-2.317-0.685-3.823-1.522c-6.836-3.802-53.454-19.196-54.545-18.01c-0.255,0.278-0.558,1.815-0.671,3.417c-0.188,2.659,0.501,3.226,8.055,6.619c28.843,12.951,58.013,34.96,66.693,50.322c1.543,2.73,3.762,6.105,4.927,7.498c2.953,3.523,6.4,2.758,10.109-2.247c3.724-5.028,4.797-13.614,2.451-19.628c-2.584-6.627-9.453-13.933-16.926-18.004l-6.975-3.799l8.284-8.739c15.736-16.604,30.355-25.762,47.054-29.475l5.333-1.186L466.338,26.51l-19.287,25.631l-131.934-0.837c0-0.46,0.95-1.485,2.108-2.273c1.162-0.79,3.008-3.638,4.102-6.331c2.848-7.014,1.793-11.743-3.981-17.855c-5.167-5.468-21.688-14.674-36.105-20.121c-8.871-3.351-9.092-3.378-10.965-1.339c-1.873,2.04-1.717,2.346,7.752,15.212c9.431,12.81,16.824,26.532,16.824,31.215v2.329l-136.913-1.104c-0.07-0.606-0.209-1.476-0.309-1.931c-0.747-6.734-1.197-13.502-1.782-20.254l-8.098,0.669l-2.87,12.137c-4.672,19.751-12.426,37.031-21.287,47.445c-8.19,9.624-11.13,19.299-7.177,23.606C118.529,115.012,126.565,117.241,132.747,117.241zFG497.863,453.926c0,0-6.328,1.162-11.621,1.771c-53.488,6.135-95.518,8.235-164.648,8.235c-92.593,0-150.715-4.537-186.435-14.549c-21.072-5.908-37.036-18.377-43.876-34.272l-2.732-6.346l-0.556-207.73l8.155-6.395c4.486-3.517,8.03-6.792,7.876-7.278c-0.553-1.763-29.472-28.583-30.439-28.232c-0.547,0.199-4.038,5.058-7.757,10.798l-6.765,10.436l-28.088,0.552l-28.089,0.551l9.016,9.771l9.016,9.771l8.486-2.245c12.449-3.293,19.834-4.607,25.896-4.607h5.386v208.28L0,454.15l27.968,27.782c0.589-0.797,6.647-11.381,13.463-23.516c6.816-12.139,14.04-24.721,16.056-27.961c4.235-6.812,10.905-13.735,12.644-13.133c0.658,0.229,6.095,8.291,12.084,17.92c12.337,19.834,13.402,21.227,20.836,27.254c22.951,18.607,65.076,28.838,128.873,31.293c74.453,2.68,148.922,4.115,223.418,3.92l1.873-5.76c3.664-11.26,17.123-22.103,33.396-26.896l6.779-2v-4.248C497.389,456.469,497.863,453.926,497.863,453.926zFG67.377,99.175c3.615,13.117,7.038,20.628,10.361,22.734c4.389,2.782,9.84,0.074,15.801-7.847c6.25-8.306,9.067-16.414,9.077-26.118c0.018-20.292-12.427-36.144-44.859-57.137c-7.896-5.112-24.133-14.715-24.878-14.715c-1.627,1.909-3.001,4.063-4.373,6.208l5.627,7.655C50.934,52.805,59.531,70.706,67.377,99.175zFG173.771,362.742l0.52-190.884l3.063-2.758l3.062-2.759l-7.109-7.678l-7.108-7.678l-3.356,3.542c-3.192,3.369-3.737,3.542-11.244,3.542c-6.402,0-9.319-0.623-15.48-3.311c-4.175-1.82-8.006-3.31-8.513-3.31c-0.549,0-0.621,11.039-0.176,27.31c0.955,34.97,0.958,91.285,0.006,111.164c-1.267,26.447-4.287,49.291-9.586,72.48c-3.079,13.479-3.482,16.498-2.39,17.932c0.721,0.947,1.631,1.721,2.021,1.721c1.117,0,8.793-15.195,12.104-23.961c5.931-15.701,10.866-37.443,12.781-56.309l0.701-6.898h17.026l-1.326,55.17c-1.423,3.031-2.515,3.168-13.619,1.717c-6.279-0.819-6.333-0.807-6.333,1.927c0,1.928,2.073,5.016,6.923,10.313c4.599,5.021,7.539,9.328,8.759,12.826c1.563,4.484,2.151,5.162,3.969,4.582c5.182-1.656,9.604-6.027,12.419-12.273L173.771,362.742z M160.092,286.059h-17.225v-55.169h17.225V286.059z M160.092,222.062h-17.225V169.1h17.225V222.062zFG293.07,161.867l-28.633,0.519l9.645,13.688l4.053-1.601c9.032-3.139-3.802-2.639,40.807-2.178l36.75-0.577l-9.136-9.302l-9.138-9.302l-15.717,8.237L293.07,161.867zFG222.14,68.533l-13.546,14.79c-10.902,11.906-16.242,16.731-27.367,24.737c-13.609,9.792-34.075,21.463-47.984,27.362c-8.677,3.68-8.933,3.929-7.692,7.482l0.995,2.851l11.961-3.866c26.478-8.556,46.305-17.892,73.013-34.374c22.589-13.94,23.673-14.466,32.708-15.858l8.12-1.25l-15.104-10.938L222.14,68.533zFG346.897,139.838c-4.937-4.418-9.556-8.035-10.266-8.035c-0.711,0-4.132,1.274-7.604,2.83c-6.304,2.824-6.376,2.832-36.464,3.368l-30.149,0.54l9.534,13.669L280.5,149c20.153-0.787,75.367-1.13,75.367-1.13L346.897,139.838zFG191.97,200.99l-7.131,5.135l3.792,7.141c2.085,3.927,4.154,7.11,4.598,7.071s2.631-0.968,4.859-2.064c4.674-2.301,15.125-4.473,32.423-6.736c6.687-0.875,12.5-1.596,12.919-1.602c0.418-0.005,0.76,1.944,0.76,4.333s0.445,5.615,0.988,7.172c1.354,3.878,2.733,3.569,7.275-1.629c3.089-3.538,3.895-5.307,3.886-8.552c-0.012-5.345-4.213-13.069-12.353-22.718c-6.06-7.182-6.586-7.55-9.729-6.798l-3.324,0.795l2.109,3.488c2.306,3.813,8.108,15.761,8.108,16.697c0,0.321-9.46,0.571-21.024,0.557l-21.024-0.027l5.573-5.173c9.319-8.649,25.171-25.794,30.967-33.491c3.499-4.647,7.001-8.021,9.703-9.348l4.227-2.077l-7.502-7.476c-4.127-4.112-7.962-7.478-8.522-7.478c-0.56-0.001-2.04,2.853-3.289,6.343c-1.25,3.49-3.177,7.958-4.286,9.931l-2.016,3.586h-15.214c-8.367,0-15.214-0.389-15.214-0.863c0-1.57,32.485-31.646,36.547-33.836c2.19-1.181,3.977-2.423,3.971-2.758c-0.01-0.471-16.511-11.646-19.253-13.038c-0.314-0.159-1.139,2.018-1.831,4.838c-4.399,17.911-17.597,37.768-28.624,43.065c-2.208,1.061-3.893,2.242-3.744,2.625c0.147,0.384,2.041,4.976,4.206,10.205l3.936,9.507l3.157-2.587c1.735-1.424,1.981-2.978,7.862-4.304c5.551-2.023,17.526-4.417,19.151-3.827c1.393,0.506-8.597,15.994-15.084,23.384C201.226,193.434,195.893,198.165,191.97,200.99zFDG212.273,453.381c3.344,0.342,48.484,0.586,100.309,0.541c104.205-0.092,103.413-0.051,118.041-5.967c5.849-2.363,13.173-7.344,13.173-8.955c0-0.326-1.924-1.367-4.281-2.314c-6.762-2.721-13.946-8.301-16.041-12.454c-1.045-2.07-2.46-6.722-3.145-10.333l-1.247-6.569h-7.71l-0.052,8.836c-0.064,11.17-0.775,16.463-2.543,18.949c-0.769,1.08-3.727,3.758-7.037,3.852c-75.582,2.135-45.149,2.668-178.322,1.857l-3.958-2.023c-7.031-3.596-8.162-5.832-8.495-16.811l-0.294-9.677l7.403-9.295c-0.404-0.127-7.347-2.629-15.428-5.555l-14.692-5.318l-0.294,17.783c-0.404,24.496,0.977,30.943,7.974,37.199C199.686,450.748,204.608,452.6,212.273,453.381zFG154.256,404.033c-8.408,11.227-12.161,14.928-23.174,22.85c-9.769,7.023-12.531,9.717-12.531,12.219c0,2.013,2.844,4.125,7.092,5.271c5.889,1.586,15.512,0.643,20.592-2.021c11.565-6.061,17.982-18.053,19.518-36.479l0.688-8.248l-2.993-0.937C160.487,395.766,160.388,395.846,154.256,404.033zFG467.429,427.342c7.128,6.679,13.961,12.64,15.182,13.246c2.935,1.459,3.889,1.433,6.477-0.188c4.783-2.996,7.222-17.277,3.925-22.98c-2.907-5.024-19.268-12.119-49.51-21.471l-6.883-2.13l-1.896,2.789l-1.896,2.789l10.818,7.902C449.596,411.645,460.298,420.664,467.429,427.342zFG269.754,387.078c23.155,8.477,43.153,21.201,61.019,38.826c4.429,4.369,9.442,8.715,11.146,9.653c5.188,2.869,9.702,1.068,12.854-5.127c3.214-6.315,1.988-12.452-3.85-19.299c-7.554-8.856-35.523-19.508-81.013-30.853c-5.78-1.442-6.18-1.364-7.217,1.421C261.796,384.111,261.941,384.221,269.754,387.078zFEDG467.412,353.047c-2.155,3.582-4.95,3.83-15.26,1.361c-8.745-2.096-8.292-2.172-8.292,1.41c0.002,2.524,0.918,3.666,4.922,6.123c7.375,4.526,13.388,10.608,15.398,15.578l1.795,4.434l3.04-1.924c4.878-3.088,12.663-13.078,14.016-17.979c0.923-3.36,1.241-28.937,1.241-99.608c0-94.833,0.008-95.104,2.189-98.953c1.205-2.123,2.022-4.032,1.813-4.239c-1.136-1.142-19.828-13.102-20.033-12.818c0.024,38.464,2.318,76.997,1.136,115.494C469.258,344.197,469.128,350.195,467.412,353.047zFG460.258,187.415c-0.833-0.828-19.634-12.998-20.08-12.998c-0.276,0-0.206,1.396,0.158,3.104c0.88,4.141,0.673,134.569,0.673,134.569l-1.222,13.625l4.368-2.914c2.401-1.604,6.139-4.033,8.304-5.404c3.392-2.143,3.833-2.873,3.206-5.307c-2.539-38.09-0.279-76.467-1.546-114.606l3.234-4.867C459.136,189.939,460.443,187.599,460.258,187.415zFEDG324.872,336.477c0.914,3.049,2.071,6.414,2.574,7.476c0.503,1.063,1.563,1.934,2.354,1.934c1.909,0,6.542-8.731,7.288-13.739c0.53-3.578,0.188-4.396-3.511-8.222c-7.599-7.87-18.464-13.133-18.464-8.938c0,0.475,1.821,4.258,4.047,8.406C321.389,327.535,323.957,333.424,324.872,336.477zFG305.599,322.059c-4.9-3.918-6.319-4.567-7.93-3.629c-1.078,0.629-1.729,1.725-1.446,2.437c5.487,13.84,7.747,19.838,7.747,20.557c0,0.486,0.688,2.681,1.534,4.879c0.843,2.197,2.206,3.996,3.025,3.996c2.134,0,6.729-8.422,7.35-13.467C316.503,331.787,314.914,329.504,305.599,322.059zFG267.803,322.389l-2.938,0.803c-1.614,0.443-2.983,0.89-3.041,0.99c-0.06,0.103-1.337,3.164-2.841,6.805c-1.502,3.642-5.028,10.438-7.834,15.105c-2.808,4.664-4.946,9.367-4.754,10.451c0.192,1.086,1.484,2.6,2.874,3.363c3.453,1.902,5.027,1.771,8.807-0.736c5.485-3.646,8.052-11.264,9.083-26.965L267.803,322.389zFG292.098,349.443c5.434-10.875,4.582-14.133-6.117-23.508c-6.394-5.601-7.758-6.367-9.508-5.349c-1.121,0.654-1.82,1.772-1.552,2.483c0.871,2.291,7.397,20.984,9.218,26.396C286.454,356.352,288.646,356.346,292.098,349.443zFG358.401,313.439c0.123-1.76,1.138-4.265,2.258-5.562l2.036-2.36l-7.324-6.765l-7.323-6.762l-6.177,6.446h-29.793v-8.83h37.606l-5.834-7.723c-3.209-4.248-6.22-7.723-6.688-7.723c-0.467,0-2.638,0.994-4.822,2.205c-6.396,3.053-13.453,2.074-20.265,2.207v-9.93h37.669l-8.936-11.33l-3.434-4.158l-4.488,2.227c-3.313,1.645-6.624,2.227-12.65,2.227h-8.161v-9.929h23.938h23.941l-10.257-8.925l-10.26-8.924l-5.087,3.407l-5.085,3.409h-28.884h-28.885l-6.724-3.319c-3.697-1.827-6.853-3.181-7.01-3.009c-0.158,0.172,0.092,4.273,0.555,9.113c1.08,11.3,1.058,51.577-0.039,67.229c-0.467,6.647-0.75,12.157-0.631,12.248c0.119,0.088,4.18-0.32,9.025-0.906l8.811-1.063l0.31-3.459l0.31-3.457h32.93h32.93l-0.027,11.033c-0.035,14.659-2.152,22.293-7.934,28.588c-5.641,6.143-10.338,7.366-28.119,7.342c-7.742-0.01-14.074,0.404-14.074,0.924c0,1.494,2.207,2.934,6.586,4.293c7.826,2.428,15.965,9.639,17.98,15.93c0.399,1.252,9.794-1.801,15.963-5.188c8.899-4.885,15.709-11.869,19.164-19.662c2.923-6.592,6.166-20.684,6.166-26.797C357.673,324.498,358.316,314.664,358.401,313.439z M275.777,251.361l0.33-3.128h21.277v8.828l-10.402,0.314C275.643,257.719,275.139,257.449,275.777,251.361z M297.893,298.439h-22.291v-8.83h22.291V298.439z M297.386,278.023l-21.075-0.148c-0.968-2.947-0.68-6.131-0.709-9.23h22.408L297.386,278.023zFEG365.116R3,57.187,0.063,57.187l3.227O2I5H9-8.546c2.367N8,4.018-5.628,8.578-7.33,10.139c-3.631,3.326-3.104,3.846-9.88-9.668l-4.288-8.553h21.935Q8X4K1P5l-2.92-4.137c-1.605U7S2,0.083l-0.079-16.15l23.022JY4-4.694l-6.332-4.694v78.42h-6.791h-6.793l3.885,4.332C362.113,316.086,362.989,316.543,365.116,315.664z M383.404W8,32.667c1.746,2.82,3.274T383.383,356.627,383.404,314.583,383.404,314.583zFE',/D/g,D),/E/g,E),/F/g,F),/G/g,G),/H/g,H),/I/g,I),/J/g,J),/K/g,K),/N/g,N),/O/g,O),/P/g,P),/Q/g,Q),/R/g,R),/S/g,S),/T/g,T),/U/g,U),/W/g,W),/X/g,X),/Y/g,Y) +'</svg>');</script>

```
> 6 votes

# Answer
## Java - 9711 ~~9826~~ bytes

```
import java.io.*;import java.util.zip.*;class b{public static void main(String[]v)throws Exception{ByteArrayInputStream c=new ByteArrayInputStream(java.util.Base64.getDecoder().decode("[encoded data, 9340 characters]".getBytes()));ZipInputStream z=new ZipInputStream(c);byte[]a=new byte[15498];z.getNextEntry();for(int j=0;j<15498;j++){a[j]=(byte)z.read();}a[15497]=0;System.out.print(new String(a));}}

```

```
I felt free to  remove the comment in the original svg, removed some
whitespaces and saved it 115 bytes because of being better to compress.
```

Tried to make it as short as possible. Seems like I need a better compression algorithm but I think it's good enough for my second post on StackExchange.

Ungolfed source (for understanding the code):

```
import java.io.*;
import java.util.zip.*;

class b {
public static void main(String[] v) throws Exception {
    ByteArrayInputStream c = new ByteArrayInputStream(
            java.util.Base64
                    .getDecoder()
                .decode("[encoded data, 9340 characters]"
                            .getBytes()));
    ZipInputStream z = new ZipInputStream(c);
    byte[] a = new byte[15498];
    z.getNextEntry();
    for (int j = 0; j < 15498; j++) {
        a[j] = (byte) z.read();
    }
    a[15497] = 0;
    System.out.print(new String(a));
    }
}

```
> 2 votes

# Answer
## Python 2.7, 9279 bytes

```
import zlib,base64
print zlib.decompress(base64.b64decode('[encoded data, 9664 characters]'))

```
> 0 votes

---
Tags: code-golf, graphical-output, kolmogorov-complexity
---


title: Google Code Jam - New Lottery Game

text:
# Question
Title: Google Code Jam - New Lottery Game
I was looking around on the web and I found this Google Code Jam Puzzle. I really liked it so I decided to post it here.

> ### New Lottery Game
>
> The Lottery is changing! The Lottery used to have a machine to generate a random winning number. But due to cheating problems, the Lottery has decided to add another machine. The new winning number will be the result of the bitwise-AND operation between the two random numbers generated by the two machines.
>
> To find the bitwise-AND of *X* and *Y*, write them both in binary; then a bit in the result in binary has a 1 if the corresponding bits of *X* and Y were both 1, and a 0 otherwise. In most programming languages, the bitwise-AND of *X* and *Y* is written *X&Y*.
>
> For example: The old machine generates the number *7 = 0111*. The new machine generates the number *11 = 1011*. The winning number will be *(7 AND 11) = (0111 AND 1011) = 0011 = 3*.
>
> With this measure, the Lottery expects to reduce the cases of fraudulent claims, but unfortunately an employee from the Lottery company has leaked the following information: the old machine will always generate a non-negative integer less than *A* and the new one will always generate a non-negative integer less than *B*.
>
> Catalina wants to win this lottery and to give it a try she decided to buy all non-negative integers less than *K*.
>
> Given *A*, *B* and *K*, Catalina would like to know in how many different ways the machines can generate a pair of numbers that will make her a winner.
>
> Could you help her?
>
> **Input**
>
> The first line of the input gives the number of test cases, T. T lines follow, each line with three numbers A B K.
>
> **Output**
>
> For each test case, output one line containing "Case #x: y", where x is the test case number (starting from 1) and y is the number of possible pairs that the machines can generate to make Catalina a winner.
>
> **Limits**
>
> 1 ≤ *T* ≤ 100. Small dataset
>
> 1 ≤ *A* ≤ 1000. 1 ≤ *B* ≤ 1000. 1 ≤ *K* ≤ 1000. Large dataset
>
> 1 ≤ *A* ≤ 109. 1 ≤ *B* ≤ 109. 1 ≤ *K* ≤ 109. Sample
>
> ```
> Input                 Output
> 5                     Case #1: 10
> 3 4 2                 Case #2: 16
> 4 5 2                 Case #3: 52
> 7 8 5                 Case #4: 2411
> 45 56 35              Case #5: 14377
> 103 143 88
>
> ```
>
> In the first test case, these are the 10 possible pairs generated by the old and new machine respectively that will make her a winner: \<0,0\>, \<0,1\>, \<0,2\>, \<0,3\>, \<1,0\>, \<1,1\>, \<1,2\>, \<1,3\>, \<2,0\> and \<2,1\>. Notice that \<0,1\> is not the same as \<1,0\>. Also, although the pair \<2, 2\> could be generated by the machines it wouldn't make Catalina win since *(2 AND 2) = 2* and she only bought the numbers 0 and 1.

Here's the link for actual problem: https://code.google.com/codejam/contest/2994486/dashboard#s=p1

This is code-golf, so shortest code wins. Good Luck

# Answer
# Ruby, 107

I expected this would be a much shorter program.

```
gets
loop{a,b,k=gets.split.map &:to_i
puts"Case ##{$.-1}: #{[*0...a].product([*0...b]).count{|x,y|x&y<k}}"}

```

## Explanation

* The first line of input can be ignored.
* `$.` is the last read line number.
* `[*0...x]` is a quick way to turn the `Range` into an `Array`. It uses the splat operator (`*`). Note that the `Range` is an exclusive one (`...` instead of `..`).
* `Array#count` takes a block. It will only count the elements for which the block returns a truthy value.
> 6 votes

# Answer
## APL (63)

It's the I/O that costs a lot.

```
↑{a b k←¯1+⍳¨⎕⋄'Case #',(⍕⍵),': ',⍕+/∊k∊⍨a∘.{2⊥∧/⍺⍵⊤⍨10/2}b}¨⍳⎕

```

Explanation:

* `{`...`}¨⍳⎕`: read a number N from the keyboard, and run the following function for each number from 1 to N.
* `a b k←¯1+⍳¨⎕`: read three numbers from the keyboard, generate a list from 0..n-1 for each, and store these in `a`, `b`, and `k`.
* `a∘.{`...`}b`: for each combination of values from `a` and `b`:
    + `⍺⍵⊤⍨10/2`: get the 10-bit binary representation for both values (this is enough given the limits)
    + `∧/`: *and* together all pairs of bits
    + `2⊤`: turn it back into a number
* `k∊⍨`: for each of these values, test if it is in `k`
* `+/`: sum the result
* `'Case #',(⍕⍵),': ',⍕`: generate the output string for this case
* : turn the result into a matrix, so each string ends up on a separate line.

Test:

```
      ↑{a b k←¯1+⍳¨⎕⋄'Case #',(⍕⍵),': ',⍕+/∊k∊⍨a∘.{2⊥∧/⍺⍵⊤⍨10/2}b}¨⍳⎕
⎕:
      5
⎕:
      3 4 2
⎕:
      4 5 2
⎕:
      7 8 5
⎕:
      45 56 35
⎕:
      103 143 88
Case #1: 10
Case #2: 16
Case #3: 52
Case #4: 2411
Case #5: 14377

```
> 2 votes

# Answer
## Golfscript - 74 64

Here is my Golfscript solution (could probably be improved):

```
n/(;0:m;{[~0:w.{{.2$&3$<w+:w;)}4$*;)0}5$*];'Case #'m):m': 'w n}%

```

Here is the pseudocode I used for this:

```
Split string at newlines
Get rid of first element (this is not needed, as I am looping through each element anyway)
Let m=0 (case #)
For each group of 3 numbers A, B, and K:
  Let w=0 (number of winning combinations)
  For(C,0,A-1)
    For(D,0,B-1)
      If (A&B)<K
        Let w=w+1 (one more winning combination)
      End
    End
  End
  Let m=m+1 (case # incremented)
  Output("Case #",m,": ",w,"/n")
End

```

Assumes valid input.
> 1 votes

# Answer
## CJam - 62

Could probably be improved; this is just a port of my Golfscript answer.

```
qN/(;{[~0_{{_2$&3$<V+:V;)}4$*;)0}5$*];"Case #"T):T": "V0:V;N}%

```
> 1 votes

# Answer
# Ruby - 145

I'm still learning Ruby, so there's probably a shorter way to do this.

```
(1..gets.to_i).each{|_|a,b,k=gets.split.map{|x|x.to_i};x=0;(0...k).each{|i|(0...a).each{|j|(0...b).each{|k|x+=1 if j&k==i}}};p"Case ##{_}: #{x}"}

```

**Ungolfed**:

```
( 1 .. gets.to_i ).each{ | _ |
    a, b, k = gets.split.map{ | x | x.to_i }
    x = 0

    ( 0 ... k ).each{ | i |
        ( 0 ... a ).each{ | j |
            ( 0 ... b ).each{ | k |
                x += 1 if j & k == i
            }
        }
    }

    p "Case ##{_}: #{x}"
}

```
> 0 votes

# Answer
## J, 90 (70)

I/O to stdin/stdout, works as a script (**90**).

```
,&LF@('Test #'&,)"1@(":@#,{:)\@:}.@:(': '&,"1)@(+/@,@(>`(17 b./&i.)/@|.)&.".;._2)&.stdin''

```

Input on stdin, output implicit in REPL (akin to APL, I believe) (**70**).

```
'Test #',"1(":@#,{:)\}.': ',"1+/@,@(>`(17 b./&i.)/@|.)&.".;._2 stdin''

```

Ergh, J isn't good at I/O requirements like these.

For the curious, the part doing the heavy work is `+/@,@(>`(17 b./&i.)/@|.)&.".`, which solves a single line of the problem (taking and returning a string).
> 0 votes

# Answer
## CJAM - 57

```
0li{)"Case #"\':Sl~:K;L\{(2$,{1$&@+\}%~}h;\;{K<},,N4$}\*;

```

I think this can be golfed further.

```
0                                  acts as a counter for the case #
  li{                              accepts the first line of input as integer/opens block
     )                             iterates counter
      "Case #"\':S                 adds "Case #X: " to stack (though in 4 parts)
       l~:K;L\                     takes next line of input, assign K, add null array
         {
          (2$,                     decrease B and generate list of number <A
           {
            1$&                    Copy the current value of B, do & with current n<A
             @+\                   Add the new possible lottery number to array
           }%~                     loop for each element if the list of numbers <A
         }h                        loop which repeats for all numbers less than B
       ;/;{K<},,                   trim and count the possible numbers less than K
      N4$                          add new line and copy the counter back in place
  }\*                              runs the block T times
;                                  removes the counter so it doesn't print

```

Output:

```
Case #1: 10
Case #2: 16
Case #3: 52
Case #4: 2411
Case #5: 14377

```
> 0 votes

---
Tags: code-golf
---


title: Self containing logs

text:
# Question
Title: Self containing logs
# The "problem"

Define a function `log` (or other 3 letter name) which when called will log/print/write (whatever is the default for the language in question) both the instruction (as source) and the first argument. In other words:

```
i=777
j=333
log(i) //outputs: "log(i) 777"
log(i+j+1) //outputs: "log(i+j+1) 1111"

```

For all practical purposes the output `i: 777` would be enough, but in some languages there are very specific reflection libraries for that, and that would be no challenge, so the entire instruction should be outputted.

# Inspiration

The inspiration for this was me and another programmer discussing how irritating it is that often (with bad debuggers), you write things like `console.log("i:", i)`, next we made a (pretty crazy) javascript (node only) solution (it outputs `i: 777` rather than the entire line of source) which was suprisingly long and reminded me of codegolfing and made me wonder how much better other (especially code golfing) languages would fare.

# Bonuses

**-10%**: No file reading (beyond the compiler)

PS. This is my first 'question' here, so feel free to point out any mistakes I made.

# Answer
> 14 votes
# C ~~(40 -10% = 36)~~ (38 -10% = 34.2)

Note that, in C, a `log` function can only be defined for a specific type. Therefore, this `log` "function" takes only `int` arguments.

```
#define log(x)printf("log("#x") %d",x)

```

A more general solution specifies how to print the argument, in addition to the argument itself:

```
#define lg2(f,x)printf("lg2("#x") "f,x)

```

which would be used as e.g. `lg2("%s", "I'm a string");` or `lg2("%f", 3.1415)`.

# Answer
> 10 votes
# Python (65 -10% = 58.5)

This assumes your code is in a file (it produces odd output if invoked in the interactive interpreter):

```
import traceback as t
def log(x):print t.extract_stack()[-2][3],x

```

It has been tested on Python 2.7.6.

Example:

```
def foo():
    x = 1
    log(x)
    for i in xrange(10):
        log(x+i+1)
    return x

log(foo())

```

outputs

```
log(x) 1
log(x+i+1) 2
log(x+i+1) 3
log(x+i+1) 4
log(x+i+1) 5
log(x+i+1) 6
log(x+i+1) 7
log(x+i+1) 8
log(x+i+1) 9
log(x+i+1) 10
log(x+i+1) 11
log(foo()) 1

```

# Answer
> 9 votes
# C++ ~~121~~ ~~71~~ 67 -10% = 60.3

```
#include<iostream>
#define log(x)std::cout<<"log("#x") "<<(x)<<"\n"

```

Used like this:

```
int main() {
    int i = 777;
    int j = 333;
    log(i);
    log(i+j+1);
}

```

Outputs:

```
log(i) 777
log(i+j+1) 1111

```

# Answer
> 5 votes
# Rebol3 - 31.5 (35 - 10 %)

Here is a simple implementation shortened from @draegtun that works well for numbers:

```
log: func[p][print[{log[}p{]}do p]]

```

Running it outputs:

```
>> log: func[p][print[{log[}p{]}do p]]
>> i: 777
>> j: 333
>> log [i]
log[ 777 ] 777
>> log[i + j + 1]
log[ i + j + 1 ] 1111

```

It can be much more flexible (for displaying the form of non-number types) at **42.3 chars (47 - 10%)**

```
log: func[p][print[{log}mold p mold/only do p]]

```

The output:

```
>> log: func[p] [print[{log}mold p mold/only do p]]
>> log [join "4" 4]
log [join "4" 4] "44"  ;; shows a string
>> log [1 + 2]
log [1 + 2] 3

```

# Answer
> 4 votes
# Javascript (325)

I think this is the `log` function you are looking for:

```
function log(m){L=(new Error()).stack.match(/(at log \([\s\S]+?at .+?:)\d+:\d+/m)[0].split('\n')[1].match(/:\d+:\d+/)[0];N=L.split(':')[1];C=parseInt(L.split(':')[2]);R=new XMLHttpRequest();R.open('GET',location.href,0);R.onload=function(){console.log(R.response.split('\n')[N-1].substr(C-1).split(';')[0]+' = '+m)};R.send()}

```

# Usage

```
<script>
function log(m){L=(new Error()).stack.match(/(at log \([\s\S]+?at .+?:)\d+:\d+/m)[0].split('\n')[1].match(/:\d+:\d+/)[0];N=L.split(':')[1];C=parseInt(L.split(':')[2]);R=new XMLHttpRequest();R.open('GET',location.href,0);R.onload=function(){console.log(R.response.split('\n')[N-1].substr(C-1).split(';')[0]+' = '+m)};R.send()}

function doSomething() {
  var a = 123; log(a); var b = "Hello, I am TrungDQ!"; log(b);
}
doSomething();
var message = "...or just do it out here";
log(message + "!");
</script>

```

## Output

```
log(a) = 123
log(b) = Hello, I am TrungDQ!
log(message + "!") = ...or just do it out here!

```

## Long code

```
<script>
function log(msg) {
  // Get the line number and offset of the line where is function is called
  var lineInfo = (new Error()).stack.match(/(at log \([\s\S]+?at .+?:)\d+:\d+/m)[0].split('\n')[1].match(/:\d+:\d+/)[0];
  var lineNum = lineInfo.split(':')[1];
  var charOffset = parseInt(lineInfo.split(':')[2]);

  // Get the file source
  request = new XMLHttpRequest();
  request.open('GET', window.location.href, true);

  request.onload = function() {
    // Get file source code
    var response = request.responseText;
    // Get the `log` line
    var line = response.split('\n')[lineNum - 1];
    // Get the `log` statement
    var logStatement = line.substr(charOffset - 1).split(';')[0];
    // Print it
    console.log(logStatement + ' = ' + msg);
  };
  request.send();
}

function doSomething() {
  var a = 123; log(a); var b = "Hello, I am TrungDQ!"; log(b);
}
doSomething();
</script>

```

Only works when the script is put inside `<script>` tag which is put in `.html` document because it sends a request to `location.href` to get the source code. JSfiddle, F12 Dev Tool Console, embbed `.js` files won't work, I am trying to make it available everywhere...

Anyway, this question is interesting.

# Answer
> 3 votes
# Scala - (221 - 10%) = 198.9

Yay macros! This is actually exactly the type of stuff they're for.

```
import language.experimental.macros
def log(p:Any)=macro l
def l(c:reflect.macros.Context)(p:c.Expr[Any])={import c.universe._;reify{println("log("+(c.Expr[String](Literal(Constant(show(p.tree)))).splice)+") "+p.splice)}}

```

Readable version:

```
import language.experimental.macros
def log(p: Any) = macro l
def l(c: reflect.macros.Context)(p: c.Expr[Any]) = {
  import c.universe._
  val inputString = show(p.tree)
  val inputStringExpr = c.Expr[String](Literal(Constant(inputString)))
  reify {
    println("log(" + (inputStringExpr.splice) + ") " + p.splice)
  }
}

```

Example:

```
log(1)
val x = 3
log(x)
val y = 4
log(x+y)

```

Outputs:

```
log(1) 1
log(x) 3
log(x.+(y)) 7

```

Since addition is a method call in Scala, it adds that verbose syntax back in, but it's pretty close! It's also a bit more verbose in a couple of other cases.

# Answer
> 2 votes
# bash (21 - 10% = 18.9)

This:

```
alias log=echo;set -v

```

Then use `log` like you would use `echo`:

```
log $((1+1))

```

or

```
A=2
B=3
log $((A+B))

```

This method will do all what is required; as a bonus, some extra information will also be printed, but no explicit rule forbid it.

# Answer
> 2 votes
# BASH

Arguments are not passed using "(...)" in BASH, so I let the output of 'log()' fit that style:

```
$ log(){ echo "$FUNCNAME $@: $(($@))"; }
$ i=333
$ j=777
$ log i
log i: 333
$ log i+j+1
log i+j+1: 1111

```

# Answer
> 2 votes
## Tcl, 42.3 (47 - 10%)

```
proc log c {puts [dict g [info fr -1] cmd]\ $c}

```

Usage:

```
set i 777
set j 333
log $i  ;#outputs: "log $i 777"
log [expr {$i+$j+1}] ;#outputs: "log [expr {$i+$j+1}] 1111"

```

**Edit**: small improvement

# Answer
> 2 votes
# Clojure

```
(defmacro log[x] `(let [x# ~x] (println "log("'~x")" x#)))

```

Homoiconicity has its benefits!

To use:

```
(def i 777)
(def j 333)
(log i) ;Prints log( i ) 777
(log (+ i j 1)) ;Prints log( (+ i j 1) ) 1111

```

Let's see what's happening with `macroexpand`:

```
(macroexpand '(log (+ i j 1)))
;; Prints the following:
(let* [x__1__auto__ (+ i j 1)] (clojure.core/println "log(" (quote (+ i j 1)) ")" x__1__auto__))

```

# Answer
> 2 votes
# Julia, 51\*0.9=45.9

```
julia> x=4
4
julia> macro log(x) println("log($x) $(log(eval(x)))") end
julia> @log(x)
log(x) 1.3862943611198906

```

Alternatively, but not meeting the rules

```
julia> @show log(x)
log(x) => 1.3862943611198906

```

# Answer
> 0 votes
# Common Lisp - 119.7 (133 -10%)

```
(defmacro @(&whole f &rest r)(let((g(gensym)))`(let((,g(multiple-value-list,@r)))(progn(format t"~s~{ ~a~}
"',f,g)(values-list,g)))))

```
* Named `@` because `log` is the standard logarithm function and locked by default (at least on SBCL). Also, `@` is only one character long.
* Acts as a `progn`, taking a variable number of arguments, but prints to standard output. In real applications, I would probably `signal` a condition with an S-expression instead of printing space-separated output.
* Contrary to the existing Clojure solution, we ultimately returns the value of the logged expression, so that `(@ x)` can be used whenever `x` is used.
* Printing uses `prin1`, which outputs a `read`-able string. This is useful when trying to reproduce logged expressions.
* Handles all possible types (see C answer)
* Takes into account mutliple values
* Does not produce different outputs (see Scala answer)
* Works from a file and from REPL (See Pyhton answer)
* Does not require browser/interpreter trick (Python traceback, Javascript request)

# Sample outputs:

```
CL-USER>(@ (+ 3 2))   ; user input
(@ (+ 3 2)) 5         ; printed output
5                     ; result of expression

CL-USER> (@ (values 3 4))  ; input
(@ (VALUES 3 4)) 3 4       ; logging
3                          ; first value
4                          ; second value

CL-USER>(@ (round 3.4))
(@ (ROUND 3.4)) 3 0.4000001
3                          ; rounded value
0.4000001                  ; delta

```

And finally, if I log the above `defmacro`, I have the ungolfed version:

```
CL-USER> (@ (defmacro @(&whole f &rest r)(let((g(gensym)))`(let((,g(multiple-value-list,@r)))(progn(format t"~s~{ ~a~}
"',f,g)(values-list,g))))))
STYLE-WARNING: redefining COMMON-LISP-USER::@ in DEFMACRO
(@
 (DEFMACRO @ (&WHOLE F &REST R)
   (LET ((G (GENSYM)))
     `(LET ((,G (MULTIPLE-VALUE-LIST ,@R)))
        (PROGN
         (FORMAT T ,"~s~{ ~a~}
"
                 ',F ,G)
         (VALUES-LIST ,G)))))) @
@ ; actual result

```

# Answer
> 0 votes
# PHP 138

You can't redeclare `log` in PHP without using another module (`APD`) so I used `logg` instead, i can resubmit with `log` example if needed. That's minor, but more sinful i guess is that this assume the log function is on a line by itself. I can update my answer as dictated by comments.

```
<?php function logg($v){$b=debug_backtrace()[0];$h=fopen($b['file'],"r");for($i=0;$i<$b['line']&&$l=fgets($h);$i++);echo trim($l)." $v";}

```

example output:

```
for ($i=1; $i<10; $i++) {
  $j=$i+1;
  $k=$j+1;
  logg($i+$j+$k);
  echo "\n";
}
/*
logg($i+$j+$k); 6
logg($i+$j+$k); 9
logg($i+$j+$k); 12
logg($i+$j+$k); 15
logg($i+$j+$k); 18
logg($i+$j+$k); 21
logg($i+$j+$k); 24
logg($i+$j+$k); 27
logg($i+$j+$k); 30
*/

```

---
Tags: code-golf
---


# Question
Title: Python advice: Portability of introspective function call
In Python, you can use the `dir` function on any object to get a list of the names of its instance functions:

```
>>> dir('abc')
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__','__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

```

I'm wondering if this could be a useful golfing technique in a program than calls several lengthily named functions. In such a case, I could create a function selection function `F`:

```
F=lambda o,i:eval('o.'+dir(o)[i])

```

Now suppose I have a string `s` and I want store the result of capitalizing its first letter in the variable `c`. Then instead of `c=s.capitalize(),` I could note that `capitalize` is at position 33 in the above list and do the following:

```
s='abc'
c=G(s,33)()

```

which assigns `'Abc'` to `c`.

My question is whether this is likely to work most of the time. In particular,

* Can I always count on the list being lexicographically sorted by ASCII values?
* Are there many changes to list of available between minor versions?
* Do differences exist between implementations?

Also, has anyone used this before on PPCG?

# Answer
From the documentation:

> The resulting list is sorted alphabetically

As for the differences, I think you will have to check (and specifying in your answer is probably a good idea). There are clear differences between python 2 and 3, for example, `__nonzero__` was renamed to `__bool__`.

I have never heard of any differences between implementations, but I can't find any references on this.

I don't think this has been used before in part because it will rarely save you any characters over doing something like:

```
F=str.capitalize
s='abc'
c=F(s)

```

You would need to use several different functions from `dir()` in order for this to be worth it.
> 6 votes

---
Tags: code-golf, tips, python
---


# Question
Title: How Many Guineas in a Gross of Threepennies?
Until decimalization in 1971, British money was based on dividing the pound into 240 pennies. A shilling was 12 pennies so 20 shillings made a pound. The smallest denomination was the farthing at one fourth of a penny. There were many other denominations and nicknames for coins, which can get quite confusing if you're not used to the system.

# Challenge

Write a program or function that can convert (almost) any denomination of old English money to any other. To make it easier for the user you need to support plurals and nicknames.

These are the denominations and their synonymous terms you must support. For convenience their value in farthings leads each line.

```
1: farthing, farthings
2: halfpence, halfpenny, halfpennies
4: penny, pennies, pence, copper, coppers
8: twopenny, twopennies, twopence, tuppence, half groat, half groats
12: threepence, threepenny, threepennies, threepenny bit, threepenny bits, thruppence, thrupenny, thrupennies, thrupenny bit, thrupenny bits
16: groat, groats
24: sixpence, sixpenny, sixpennies, sixpenny bit, sixpenny bits, tanner, tanners
48: shilling, shillings, bob
96: florin, florins, two bob bit, two bob bits
120: half crown, half crowns
240: crown, crowns
480: half sovereign, half sovereigns
504: half guinea, half guineas
960: pound, pounds, pounds sterling, sovereign, sovereigns, quid, quids
1008: guinea, guineas

```

<sup>(I am not British, this list is by no means authoritative but it will suffice for the challenge.)</sup>

Via stdin or function argument you should take in a string of the form

```
[value to convert] [denomination 1] in [denomination 2]

```

and return or print

```
[value to convert] [denomination 1] is [converted value] [denomination 2]

```

where `[converted value]` is `[value to convert]` units of denomination 1 converted to denomination 2.

The `[value to convert]` and `[converted value]` are positive floats. In the output both should be rounded or truncated to 4 decimal places. If desired you may assume `[value to convert]` always has a decimal point and zero when input (e.g. `1.0` instead of `1`).

Denominations 1 and 2 may be any two terms from the list above. Don't worry about whether they're plural or not, treat all denominations and synonyms the same. You may assume the input format and denominations are always valid.

# Examples

`1 pounds in shilling``1 pounds is 20 shilling`
(`1.0000 pounds is 20.0000 shilling` would be fine)

`0.6 tuppence in tanner``0.6 tuppence is 0.2 tanner`

`24 two bob bits in pounds sterling``24 two bob bits is 2.4 pounds sterling`

`144 threepennies in guineas``144 threepennies is 1.7143 guineas`

# Scoring

The shortest code in bytes wins.

# Answer
# Pyth, 146 145

```
K4J24L?*y>b-5>b\t?2>b\t.5}<b2"hatw"@[1K8K12K16J48J1008*JT96*2J960)xc"fapetucothengrsishtagucrflbo"2<b2AGHcz" in"++G%" is %0.4f"*vhcGdcyjdtcGdytHH

```

More readable (newlines and indents must be removed to run):

```
K4J24
L?*y>b-5>b\t?2>b\t.5
  }<b2"hatw"
  @[1K8K12K16J48J1008*JT96*2J960)
   xc"fapetucothengrsishtagucrflbo"2<b2
AGHcz" in"
++G
  %" is %0.4f"
   *vhcGdcyjdtcGdytH
 H

```

Update: Turns out, it's 1 character shorter (no space needed) to chop up the string into a list of 2 character strings before running the string index operation. `/x"string"<b2 2` -\> `xc"string"2<b2`. Nothing else needs to be changed.

How it works:

* This uses @xnor's approach of looking up the value of currency using its first two letters, as well as the trick of detecting the initial `half` or `two`, removing it and calling the function again.
* To lookup the value of the first two characters, it finds the location of the first two letters of the currency in a string, then divides by 2 and takes the value at that index in the list. This is much shorter than an dict in pyth.
* Uses the fact that `x` (find within string) returns -1 on failure to avoid putting `po` (pounds) `qu` (quid) or `so` (sovereigns) in the string, and simply return the last element of the list, 960, by default.
* By rearranging the order of currencies in the lookup system and initializing carefully, with `K4` and `J24`, all spaces that would have been needed to separate numbers in the list were removed.
* Uses pyth's dual assignment operator, `A`, on the input split on  `in` to get the beginning and end of the input in separate variables.
* Does essentially the same lookup at the end, though pyth has no `.split(_,1)`, so it is somewhat more cumbersome.

Examples:

```
$ pyth programs/currency.pyth <<< '5 florins in half guineas'
5 florins is 0.9524 half guineas

$ pyth programs/currency.pyth <<< '0.4 quid in sixpenny bits'
0.4 quid is 16.0000 sixpenny bits

```
> 9 votes

# Answer
## Ruby, ~~345~~ ~~306~~ ~~302~~ ~~288~~ ~~287~~ ~~278~~ ~~273~~ ~~253~~ ~~252~~ ~~242~~ ~~232~~ ~~221~~ ~~202~~ 190 bytes

```
f=->s{" !#+/7OďǿȗϟЏ'"[%w{fa fp ^pe|co r..p ^gr x|ta sh|^b fl|b f.c ^c f.s .gu d|v ^g .}.index{|k|s[/#{k}/]}].ord-31}
$><<gets.sub(/ (.+ i)n /){" #{r=$1}s %0.4f ".%$`.to_f/f[$']*f[r]}

```

Takes input from STDIN and prints to STDOUT.

I'm using short regular expressions to match only the desired denominations for each value. There are two arrays, one with regexes and one with values, at corresponding indices. The regex array is a space delimited array literal, and the value array is packed into a string of UTF-8 characters.

I'm selecting the index into the values by searching for a regex that matches each denomination. I'm also defaulting to the tuppence/half-groat case (value 8), because that required the longest regex. Likewise, some of the patterns assume that other values have already been matched by earlier patterns, so each regex only distinguishes the desired value only from the remaining ones. Using this, I could probably shave off another couple of bytes by rearranging the order of the denominations.

Thanks to Ventero for helping me ~~beat Pyth~~ making it shorter!
> 14 votes

# Answer
## Python 3: 264 239 chars

```
f=lambda c:c[:2]in"hatw"and f(c[5-(c>'t'):])*2/4**(c<'t')or[1,4,4,4,8,12,16,24,24,48,48,96,240,1008,960]['fapecoentuthgrsitashboflcrgu'.find(c[:2])//2]
a,b=input().split(" in ")
x,c=a.split(" ",1)
print(a,"is %0.4f"%(eval(x)*f(c)/f(b)),b)

```

The function `f` gets the shilling value of the currency-string `c` by fingerprinting the first two letters using the dictionary by finding them in a string. The prefixes "half" and "two" are detected and accounted for by chopping the prefix and the space and applying a multiplier. Since "halfpenny" lacks a space after "half", this results in "enny", but that's handled with a fictional "en" entry.

Thanks to @isaacg and @grc for lots of improvement on the dictionary lookup.
> 8 votes

# Answer
## Python 2 - 345 ~~358~~

```
s=str.startswith
h='half'
u,v=raw_input().split(' in ')
a,b=u.split(' ',1)
C=dict(fa=1,pe=4,twop=8,tu=8,thr=12,gr=16,si=24,ta=24,sh=48,b=48,fl=96,c=240,po=960,so=960,q=960,gu=1008)
C.update({h+'p':2,h+' gr':8,'two ':96,h+' c':120,h+' s':480,h+' gu':504})
for c in iter(C):
 if s(b,c):k=C[c]
 if s(v,c):f=C[c]
print u+' is %0.4f '%(eval(a)*k/f)+v

```

Requires input number to be a float in python i.e. `144.1`

I think this could be shortened in python 3...

...Confirmed thanks to @xnor. Also confirmed that having a better algorithm matters a lot ;)
> 5 votes

# Answer
# Haskell - 315 bytes

```
w x=f(u x)*v(u x)
f=maybe 1 id.l"ha tw tu th si"[0.5,2,2,3,6]
v x@(_:xs)|Just w<-l"bo cr gr gu so co fa fl pe po qu sh ta"[12,60,4,252,240,1,0.25,24,1,240,240,12,6]x=w|True=v xs
l k v x=take 2 x`lookup`zip(words k)v
u=unwords
i s|(n:x,_:t)<-span(/="in")$words s=u$n:x++["is",show$read n*w x/w t]++t
main=interact i

```
> 2 votes

# Answer
## JavaScript (ES5), 344

```
I=prompt()
n=I.match(/[\d.]+ /)[0]
A=I.slice(n.length).split(" in ")
function m(x){return{fi:1,he:2,p:4,pe:4,cr:4,tn:8,hg:8,tp:12,te:12,g:16,gs:16,sn:24,tr:24,si:48,b:48,fn:96,to:96,hc:120,c:240,cs:240,hs:480,hgtrue:504,ps:960,se:960,q:960,ga:1008}[x[0]+(x[5]||"")+(x[10]=="a"||"")]}
alert(n+A[0]+" is "+(n*m(A[0])/m(A[1])).toFixed(4)+" "+A[1])

```

I went with a hash function approach... I think I underestimated (relatively) how complex the input processing would be (over the regex approach, that wouldn't care about the number).
> 2 votes

# Answer
Based on @FryAmTheEggMan's answer, with a different way of testing `str.startwith`:

# Python 2: 317

```
h='half'
C=dict(fa=1,pe=4,twop=8,tu=8,thr=12,gr=16,si=24,ta=24,sh=48,b=48,fl=96,c=240,po=960,so=960,q=960,gu=1008)
C.update({h+'p':2,h+' gr':8,'two ':96,h+' c':120,h+' s':480,h+' gu':504})
u,v=raw_input().split(' in ')
a,b=u.split(' ',1)
s=lambda x:x and C.get(x, s(x[:-1]))
print u+' is %0.4f '%(eval(a)*s(b)/s(v))+v

```
> 1 votes

# Answer
# JavaScript ES6, 264 273

```
f=t=>{s=t.split(x=' in')
c=d=>{'t0sh|bo0^p|co0f0fp0fl|b b0gu0d|v0wn0gr0f g|t..?p0f s0f gu0f c0x|an'.split(0).map((e,i)=>{v=s[d].match(e)?[12,48,4,1,2,96,1008,960,240,16,8,480,504,120,24][i]:v})
return v}
return s.join(' is '+~~(1e4*t.split(' ')[0]*c(0)/c(1))/1e4)}

```

```
t=prompt()
s=t.split(x=' in')
c=function(d){'t0sh|bo0^p|co0f0fp0fl|b b0gu0d|v0wn0gr0f g|t..?p0f s0f gu0f c0x|an'.split(0).map(function(e,i){v=s[d].match(e)?[12,48,4,1,2,96,1008,960,240,16,8,480,504,120,24][i]:v})
return v}
alert(s.join(' is '+~~(1e4*t.split(' ')[0]*c(0)/c(1))/1e4))
```

This gets the value of each currency by checking it against various regexes, starting with the broadest `/t/`; the value is overwritten if another match is encountered. There might be a way to shave off a couple bytes by reordering the regex string. You can test it using the snippet above (It is formatted only to use dialog boxes and remove ES6 arrow functions so everyone can test the code easily). Thanks to Alconja for the suggestions.
> 1 votes

---
Tags: code-golf, kolmogorov-complexity, arithmetic
---


title: Mondrian painting description language

text:
# Question
Title: Mondrian painting description language
This challenge consists in coding an interpreter for a Mondrian painting description language (MPDL).

## Language definition

The language operates on a stack of rectangles. A rectangle is defined by its upper left coordinate and lower right coordinate. Coordinates must be integers. The stack is initialized with a single rectangle with attributes `(1,1,254,254)`

Each command has the following format: `<character><integer>`

There are three commands:

`v<integer>` : perform a vertical split on the latest rectangle in the stack, at the position indicated by the parameter (as percentage). The source rectangle is removed from the stack and replaced with the two new rectangles that result of the split. The left rectangle is pushed on the stack, then the right rectangle. As rectangle coordinates are integers, fractions should be rounded to biggest smaller integer.

`h<integer>` : horizontal split. The top rectangle is pushed on the stack, then the bottom rectangle.

`c<integer>` : removes the latest rectangle from the stack and paints it to the color given as parameter. 1 = white, 2 = red, 3 = blue, 4 = yellow

## Challenge

Write a program that takes as parameter a painting description and creates a 256x256 bitmap representation of the painted rectangles. The rectangles must be separated with a 3 pixel black line. A one or two pixel rectangle should have his non-black pixels hidden by the border black pixels.

The input can be read as a parameter or as a file, up to you. The commands should be separated by a space. You can assume that the input file has correct syntax and does not have trailing or leading spaces, tabs, etc. The output can be directly displayed on the screen, or saved to a file, up to you.

The shortest code wins.

## Test

The following source:

```
v25 h71 v93 h50 c4 c1 c1 c2 h71 c3 h44 c1 c1

```

Should produce the *Composition II in Red, Blue and Yellow*:

# Answer
> 6 votes
# Perl 5 + ImageMagick - 297

Something to start with:

```
sub a{my($x,$y,$X,$Y,$d)=@_;$_=shift@ARGV;
/v/?a($d=$x+($X-$x)*$'/100,$y,$X,$Y).a($x,$y,$d,$Y):
/h/?a($x,$d=$y+($Y-$y)*$'/100,$X,$Y).a($x,$y,$X,$d):
/c/&&"-fill ".qw/white red blue yellow/[$'-1]." -draw 'rectangle $x,$y $X,$Y' "}
system"convert -size 256x256 -stroke black xc: ".a(0,0,255,255)."a.gif"

```

Takes input on command line and generates `a.gif`.

# Answer
> 2 votes
# Haskell - 335

```
import Diagrams.Prelude
import Diagrams.Backend.SVG
c=centerXY
d((x:n):i)|x=='v'=(b#scaleX s#c|||a#scaleX(1-s)#c,k)|x=='h'=(b#scaleY s#c===a#scaleY(1-s)#c,k)|x=='c'=(square 1#fc([white,red,blue,yellow]!!(read n-1)),i)where{s=(read n)/100;(a,j)=d i;(b,k)=d j}
main=getLine>>=renderSVG"a.svg"(Width 256).pad 1.02.c.lwG 0.012.fst.d.words

```

**The program reads the instructions as one line from stdin**, if this is unacceptable let me know.

Compiles into a program that takes in flags -w *width* -h *height* -o *outputfile*. Outputs an "a.svg" file, if that's not immediately clear from the code. Since the output is a vector image, it's not 'pixel perfect'.

This is my first time working with Diagrams -package, feel free to point out any mistakes I made. Especially any backend that would let me output with less code would be nice.

You can see some of the first steps I took when developing the code in http://paste.hskll.org/get/1737. It differs from the code above in imports and lacks main since the paste.hskll.org provides its own main and drawing environment.

# Answer
> 2 votes
## Python - ~~434 405 377 364~~ 361

My first python golf. This can probably be improved A LOT, so any feedback is appreciated.

```
from turtle import*
a=[[1,1,254,254]]
for c in input().split():
 v,w,x,y=a.pop();p,b,f,g=int(c[1::1]),'hvc'.index(c[0]),x-v,y-w
 if b>1:goto(v,-w),color('#000',['#fff','red','#00f','#ff0'][p-1]),begin_fill(),[(fd(o),rt(90))for o in[f,g]*2],end_fill()
 else:a+=[[v,w,(x,v+(((x-v)/100)*p))[b],(w+(((y-w)/100)*p),y)[b]])],a+=[[[v,a[-1][2]][b],[a[-1][3],w][b],x,y]]

```

# Answer
> 1 votes
## HTML + JavaScript ES6 (407)

Tested with Firefox 32.0.3

```
<canvas id=c width=256 height=256><script>r=[[1,1,253,253]]
p=x=>r.push(x)
o=c.getContext("2d")
o.lineWidth=3
prompt().split(" ").map(x=>{q=r.pop()
v=q[0]
b=q[1]
n=q[2]
m=q[3],{c:x=>{o.beginPath()
o.rect(v,b,n,m)
o.fillStyle=[,"#fff","red","blue","#ff0"][x]
o.fill()
o.stroke()},v:x=>{s=x/100*n|0
p([v,b,s,m])
p([v+s,b,n-s,m])},h:x=>{s=x/100*m|0
p([v,b,n,s])
p([v,b+s,n,m-s])}}[x[0]](+x.slice(1))})</script>
```

# Answer
> 1 votes
# HTML+JavaScript (ES6) 335

Too similar to @mika answer - marking CW.

* replace with function instead of split...map
* spread operator
* push 2 values at once
* ternary operator instead of function properties

```
<canvas id=c><script>
c.width=c.height=256,
s=[[1,1,253,253]],
o=c.getContext('2d'),
o.translate(0.5,0.5), // to avoid anti-alias on straight lines
o.lineWidth=3,
prompt().replace(/(\S)(\d+)/g,(_,c,n)=>(
p=s.pop(o.fillStyle=[,'#fff','red','#00f','#ff0'][n]),
c<'d'?(o.fillRect(...p),o.strokeRect(...p))
:(c=c<'i'|2,
 q=[...p],
 q[c]=r=q[c]*n/100|0,
 p[c]-=r,
 p[c-2]+=r,
 s.push(q,p))))
</script>
```

---
Tags: code-golf, graphical-output, geometry, image-processing, stack
---


title: A Good Time to Refuse

text:
# Question
Title: A Good Time to Refuse
# The Setup

Suppose you're given *n* fuses, with 1 ≤ *n* ≤ 5, each of which is a meter long, and where each fuse has an associated burn rate of *N* meters per *D* hours.

A fuse can be lit at one or both ends, subsequently extinguished at one or both ends, relit, re-extinguished, etc., as many times as needed until the fuse is fully consumed. You are able to light and extinguish fuses instantaneously, and you can observe the exact instant a fuse is fully consumed (burnt up).

A fuse *cannot* be cut nor can it be lit anywhere except at its ends.

Such a setup allows for an infinitely accurate timing system, by measuring the time between any two fuse lighting/consumption events. For example, given two fuses with a burn rate of 1 meter per hour, you can measure exactly 45 minutes (3/4 hours) by

1. simultaneously: lighting the first fuse at both ends, lighting the second fuse at one end, and marking the start of your time interval
2. lighting the second end of the second fuse at the instant the first fuse is consumed (30 minutes later)
3. marking the end of your time interval at the instant the second fuse is consumed (15 minutes later)

# The Challenge

Given a fractional number of hours *t*, and a set of *n* fractions representing exact burn rates of *n* fuses, write a program or function that outputs/returns a truthy value if *t* hours can be precisely measured through systematic burning of the fuses, or a falsy value otherwise.

The input to the program can be any of the following:

* command-line arguments of the form `TN/TD N1/D1 N2/D2 N3/D3 ...`
* a string of the form `TN/TD N1/D1 N2/D2 N3/D3 ...` read from `stdin` or equivalent
* a string of the form `TN/TD N1/D1 N2/D2 N3/D3 ...` passed as a function argument
* an array of strings `["TN/TD", "N1/D1", "N2/D2", "N3/D3", ...]` passed as a function argument

In all cases *t* = `TN`/`TD`, where `TN`,`TD` ∈ \[1,10000\].

Likewise, in all cases: burn rate for fuse *i* = *N**i* /*D**i* = `N<i>`/`D<i>`, where `N<i>`,`D<i>` ∈ \[1,10\] ∀ *i*.

You may assume there will always be between 1 and 5 fuses (inclusive), and that all inputs are valid and in-range. You may also assume that all input fractions are given in lowest terms.

**You may not use floating point numbers with fractional components for this challenge.** That is, if you use floating point numbers anywhere in your application, they may only take on integral values with zero fractional component.

# Scoring

This is a challenge, hence the shortest compliant submission in bytes will be awarded the win.

---

## Example Inputs/Outputs

```
input:  29/6 3/2 2/3 3/5 3/7 7/5
output: true

One solution:
  - light both ends of fuse 1, mark start of interval
  - on fuse 1 consumption: light both ends of fuse 2, light one end of fuse 5
  - on fuse 5 consumption: extinguish one end of fuse 2, light both ends of fuse 3,
    light both ends of fuse 4
  - on fuse 2 consumption: extinguish one end of fuse 3, extinguish both ends of
    fuse 4
  - on fuse 3 consumption: relight one end of fuse 4
  - on consumption of fuse 4: mark end of interval (29/6 hours)

input:  2/1 3/1 5/1 7/1
output: false

input:  5/1 6/1 1/6 9/1 1/9
output: true

One solution:
  - light fuse 1 at one end, light fuse 2 at both ends, light fuse 4 at both ends
  - on fuse 1 consumption: extinguish one end of fuse 2, mark start of interval
  - on fuse 4 consumption: relight one end of fuse 2
  - on fuse 2 consumption: mark end of interval (5 hours)

```

Happy fusing! :)

# Answer
# Python 2, 305

This is the golfed version. It is practically unusable for *n \> 3*, as the time (and space) complexity is like *3n2*... actually that may be way too low for the time. Anyway, the function accepts a list of strings.

```
def f(i):
 Z=range;r=map(__import__('fractions').Fraction,i);R=r[1:];n=len(R);L=[[[1]*n,[0]]];g=0
 for m,p in L:
  for d in([v/3**i%3for i in Z(n)]for v in Z(3**n)):
    try:x=min(m[i]/R[i]/d[i]for i in Z(n)if m[i]*d[i]>0);L+=[[[m[i]-x*R[i]*d[i]for i in Z(n)],[p[0]+x]+p]]
    except:g|=p[0]-r[0]in p
 return g

```

A slightly optimized version can finish the test cases in a couple of minutes. It might still be slow for an impossible *n=5* case though.

```
def fLessslow(i):
 Z=range
 r=map(__import__('fractions').Fraction,i)
 R=r[1:]
 n=len(R)
 L=[((1,)*n,(0,))]
 ls = set(L)
 for m,p in L:
  if p[0]-r[0]in p: return 1
  for d in([v/3**i%3 for i in Z(n)]for v in Z(3**n)):
   if any(d[i] and m[i]<=0 for i in Z(n)):continue
   try:
    x=min(m[i]/R[i]/d[i]for i in Z(n)if m[i]*d[i]>0)
    thing = (tuple(m[i]-x*R[i]*d[i]for i in Z(n)),(p[0]+x,)+p)
    if thing not in ls:L+=[thing];ls.add(thing)
   except:5
 return 0

print fLessslow('5/1 6/1 1/6 9/1 1/9'.split())
print fLessslow('29/6 3/2 2/3 3/5 3/7 7/5'.split())

```
> 9 votes

# Answer
# Python 2, 331

It's a little bit longer than feersum's version, but it's much faster. All testcases together take about 3 seconds on my laptop. A complete search for n=5 takes abount 10 minutes though. Some of the code is similar to feersum's version, but I didn't deliberately copy any code.

```
from fractions import*
f=Fraction
r=range
g=lambda x:h(f(x[0]),[1/f(i)for i in x[1:]],[])
def h(t,x,y):
 for i in r(1,3**len(x)):
  c=[[],[],[]]
  for j in r(len(x)):c[i/3**j%3]+=[x[j]]
  n,b,w=c
  m=min(b+[i/2 for i in w])
  if h(t,[i for i in n+[j-m for j in b]+[j-2*m for j in w]if i],[i+m for i in y]+[m]):return True
 return t in y

```

### Usage:

```
print g('3/4 1/1 1/1'.split())
print g('29/6 3/2 2/3 3/5 3/7 7/5'.split())
print g('2/1 3/1 5/1 7/1'.split())
print g('5/1 6/1 1/6 9/1 1/9'.split())

```

### Explanation:

The lambda expression g does some preprocessing of the input, like converting strings into fractions, seperating goal time from burn rates and calculating the burn times (=1/burn rate).

The function h divides all burn times x into 3 sets n, b and w (n stand for non\_burning, b for one\_end\_burning, and w for both\_ends\_burning). It iterates over all those arrangements (except the arrangement n=x, b=\[\], w=\[\]), determines the fuse with the shortest burn rate (save time in m), and recursively call h with updated burn times. In y I save all possible times someone can measure using the fuses. In the recursive call these values also get updated.

As soon as I find the value, it terminates alle calls with True.
> 3 votes

---
Tags: code-golf, puzzle-solver, rational-numbers
---