## Original Challenge Description

At the last halloween party we played some guitar hero, which was a whole lot of fun and helped me to get over my fear of ghosts. Eventually we played through all the songs the game had to offer, so I decided to create one of my own. I also added a Warmup Map called Invincible, so that you can easily shred through the other one. I hope you enjoy it!

## Files

2 Folders: Invincible [notes.chart, song.ini, song.ogg] Randy Newman - Monsters, Inc [album.png, background.png, notes.chart, song.ini, song.ogg]

The only files relevant to this challenge are the notes.chart files and there, only the [Events] and [ExpertSingle] sections you can find in the code.

They look something like this:

```
[Events]
{
288 = E "phrase_start"
384 = E "lyric a"
480 = E "phrase_end"
490 = E "phrase_start"
576 = E "lyric b"
624 = E "phrase_end"
...
}
[ExpertSingle]
{
384 = N 7 0
576 = N 0 0
768 = N 1 0
960 = N 2 0
...
}
On top, the "resolution" defines how long a beat is - in this case 192 and all notes / lyrics are exactly on a multiple of that.
```

## Solution explanation

The Invincible song contains 2^5 = 32 combinations of 5 notes.

At every time the note is played, a single letter is in the lyrics of the song.

You can observe this with the tool “Moonscraper”, a tool to build custom songs for the game “Guitar Hero”.

Then you go through the “monsters” song and every time the 6th note is played, you look up the currently pressed notes.

## Solution code

```
from collections import defaultdict
invincible_notes = '384 = N 7 0\n576 = N 0 0\n768 = N 1 0\n960 = N 2 0\n1152 = N 3 0\n1344 = N 4 0\n1536 = N 0 0\n1536 = N 1 0\n1728 = N 0 0\n1728 = N 2 0\n1920 = N 0 0\n1920 = N 3 0\n2112 = N 0 0\n2112 = N 4 0\n2304 = N 1 0\n2304 = N 2 0\n2496 = N 1 0\n2496 = N 3 0\n2688 = N 1 0\n2688 = N 4 0\n2880 = N 2 0\n2880 = N 3 0\n3072 = N 2 0\n3072 = N 4 0\n3264 = N 3 0\n3264 = N 4 0\n3456 = N 0 0\n3456 = N 1 0\n3456 = N 2 0\n3648 = N 0 0\n3648 = N 1 0\n3648 = N 3 0\n3840 = N 0 0\n3840 = N 1 0\n3840 = N 4 0\n4032 = N 0 0\n4032 = N 2 0\n4032 = N 3 0\n4224 = N 0 0\n4224 = N 2 0\n4224 = N 4 0\n4416 = N 0 0\n4416 = N 3 0\n4416 = N 4 0\n4608 = N 1 0\n4608 = N 2 0\n4608 = N 3 0\n4800 = N 1 0\n4800 = N 2 0\n4800 = N 4 0\n4992 = N 1 0\n4992 = N 3 0\n4992 = N 4 0\n5184 = N 2 0\n5184 = N 3 0\n5184 = N 4 0\n5376 = N 0 0\n5376 = N 1 0\n5376 = N 2 0\n5376 = N 3 0\n5568 = N 0 0\n5568 = N 1 0\n5568 = N 2 0\n5568 = N 4 0\n5760 = N 0 0\n5760 = N 1 0\n5760 = N 3 0\n5760 = N 4 0\n5952 = N 0 0\n5952 = N 2 0\n5952 = N 3 0\n5952 = N 4 0\n6144 = N 1 0\n6144 = N 2 0\n6144 = N 3 0\n6144 = N 4 0\n6336 = N 0 0\n6336 = N 1 0\n6336 = N 2 0\n6336 = N 3 0\n6336 = N 4 0'
invincible_events = '288 = E "phrase_start"\n384 = E "lyric a"\n480 = E "phrase_end"\n490 = E "phrase_start"\n576 = E "lyric b"\n624 = E "phrase_end"\n672 = E "phrase_start"\n768 = E "lyric c"\n864 = E "phrase_end"\n883 = E "phrase_start"\n960 = E "lyric d"\n1056 = E "phrase_end"\n1075 = E "phrase_start"\n1152 = E "lyric e"\n1248 = E "phrase_end"\n1267 = E "phrase_start"\n1344 = E "lyric f"\n1440 = E "phrase_end"\n1459 = E "phrase_start"\n1536 = E "lyric g"\n1632 = E "phrase_end"\n1651 = E "phrase_start"\n1728 = E "lyric h"\n1824 = E "phrase_end"\n1843 = E "phrase_start"\n1920 = E "lyric i"\n2016 = E "phrase_end"\n2035 = E "phrase_start"\n2112 = E "lyric j"\n2208 = E "phrase_end"\n2227 = E "phrase_start"\n2304 = E "lyric k"\n2400 = E "phrase_end"\n2419 = E "phrase_start"\n2496 = E "lyric l"\n2592 = E "phrase_end"\n2611 = E "phrase_start"\n2688 = E "lyric m"\n2784 = E "phrase_end"\n2803 = E "phrase_start"\n2880 = E "lyric n"\n2976 = E "phrase_end"\n2995 = E "phrase_start"\n3072 = E "lyric o"\n3168 = E "phrase_end"\n3187 = E "phrase_start"\n3264 = E "lyric p"\n3360 = E "phrase_end"\n3379 = E "phrase_start"\n3456 = E "lyric q"\n3552 = E "phrase_end"\n3571 = E "phrase_start"\n3648 = E "lyric r"\n3744 = E "phrase_end"\n3763 = E "phrase_start"\n3840 = E "lyric s"\n3936 = E "phrase_end"\n3955 = E "phrase_start"\n4032 = E "lyric t"\n4128 = E "phrase_end"\n4147 = E "phrase_start"\n4224 = E "lyric u"\n4320 = E "phrase_end"\n4339 = E "phrase_start"\n4416 = E "lyric v"\n4512 = E "phrase_end"\n4531 = E "phrase_start"\n4608 = E "lyric w"\n4704 = E "phrase_end"\n4723 = E "phrase_start"\n4800 = E "lyric x"\n4896 = E "phrase_end"\n4915 = E "phrase_start"\n4992 = E "lyric y"\n5088 = E "phrase_end"\n5107 = E "phrase_start"\n5184 = E "lyric z"\n5280 = E "phrase_end"\n5299 = E "phrase_start"\n5376 = E "lyric {"\n5472 = E "phrase_end"\n5491 = E "phrase_start"\n5568 = E "lyric }"\n5664 = E "phrase_end"\n5683 = E "phrase_start"\n5760 = E "lyric !"\n5856 = E "phrase_end"\n5875 = E "phrase_start"\n5952 = E "lyric _"\n6048 = E "phrase_end"\n6067 = E "phrase_start"\n6144 = E "lyric 3"\n6240 = E "phrase_end"\n6259 = E "phrase_start"\n6336 = E "lyric 4"\n6432 = E "phrase_end" '
monster_notes = '768 = N 0 0\n768 = N 1 0\n768 = N 6 0\n896 = N 2 0\n960 = N 3 0\n1088 = N 4 0\n1152 = N 3 0\n1280 = N 2 0\n1344 = N 1 0\n1344 = N 6 0\n1536 = N 0 0\n1600 = N 1 0\n1664 = N 2 0\n1728 = N 3 0\n1856 = N 4 0\n2112 = N 0 0\n2112 = N 2 0\n2112 = N 3 0\n2112 = N 6 0\n2304 = N 0 0\n2400 = N 1 0\n2448 = N 2 0\n2496 = N 3 0\n2624 = N 2 0\n2816 = N 3 0\n2880 = N 4 0\n2880 = N 6 0\n3024 = N 0 0\n3024 = N 1 0\n3024 = N 2 0\n3024 = N 3 0\n3024 = N 6 0\n3392 = N 1 0\n3456 = N 2 0\n3584 = N 0 0\n4352 = N 2 0\n4416 = N 2 0\n4544 = N 3 0\n4608 = N 4 0\n4736 = N 1 0\n4928 = N 1 336\n5312 = N 4 528\n5888 = N 2 0\n5952 = N 2 0\n6080 = N 3 0\n6144 = N 4 0\n6288 = N 0 0\n6288 = N 2 0\n6288 = N 3 0\n6288 = N 6 0\n6720 = N 4 0\n6848 = N 2 0\n6912 = N 3 0\n7040 = N 2 288\n7488 = N 1 0\n7616 = N 2 0\n7680 = N 3 0\n7808 = N 4 0\n8016 = N 0 0\n8016 = N 2 0\n8016 = N 6 0\n8768 = N 2 0\n8832 = N 2 0\n8960 = N 2 0\n9152 = N 4 0\n9408 = N 0 0\n9408 = N 1 0\n9408 = N 3 0\n9408 = N 6 0\n10368 = N 2 0\n10496 = N 0 0\n10752 = N 2 0\n10752 = N 4 0\n10752 = N 6 0\n10880 = N 1 0\n11072 = N 1 208\n11328 = N 4 0\n11456 = N 3 0\n11520 = N 2 0\n11648 = N 3 0\n11904 = N 2 0\n12096 = N 2 0\n12224 = N 3 0\n12432 = N 0 0\n12432 = N 2 0\n12432 = N 4 0\n12432 = N 6 0\n13056 = N 3 0\n13184 = N 2 208\n13584 = N 0 0\n13584 = N 1 0\n13584 = N 6 0\n13776 = N 0 0\n13776 = N 2 0\n13776 = N 6 0\n14016 = N 3 0\n14064 = N 4 0\n14112 = N 3 0\n14160 = N 2 0\n14208 = N 1 0\n14336 = N 0 0\n14400 = N 1 0\n14528 = N 2 208\n14784 = N 0 0\n14784 = N 2 0\n14784 = N 3 0\n14784 = N 4 0\n14784 = N 6 0\n16064 = N 0 0\n16128 = N 1 0\n16192 = N 2 0\n16256 = N 3 0\n16320 = N 4 0\n16640 = N 2 0\n16704 = N 2 0\n16832 = N 3 0\n16896 = N 4 0\n17024 = N 1 0\n17216 = N 1 288\n17664 = N 3 0\n17696 = N 4 0\n17792 = N 3 336\n18176 = N 2 0\n18240 = N 2 0\n18368 = N 3 0\n18432 = N 4 0\n18624 = N 0 0\n18624 = N 2 0\n18624 = N 3 0\n18624 = N 6 0\n19584 = N 1 0\n19712 = N 1 0\n19904 = N 2 0\n19968 = N 3 0\n20096 = N 4 0\n20288 = N 1 544\n21120 = N 1 0\n21248 = N 1 0\n21440 = N 4 0\n21504 = N 0 0\n21632 = N 3 864\n22656 = N 0 0\n22656 = N 2 0\n22656 = N 6 0\n22784 = N 2 0\n22848 = N 2 0\n22976 = N 3 0\n23040 = N 4 0\n23168 = N 1 0\n23360 = N 1 640\n24192 = N 2 0\n24320 = N 2 0\n24512 = N 3 0\n24576 = N 4 0\n24704 = N 0 640\n25728 = N 1 0\n25728 = N 2 0\n25728 = N 3 0\n25728 = N 4 0\n25728 = N 6 0\n26304 = N 3 0\n26432 = N 2 0\n26496 = N 1 0\n26624 = N 0 0\n26688 = N 1 0\n26816 = N 2 208\n27072 = N 0 0\n27264 = N 1 0\n27328 = N 2 0\n27392 = N 3 0\n27456 = N 4 0\n27584 = N 3 0\n27776 = N 0 0\n27840 = N 1 0\n27968 = N 0 0\n28032 = N 1 0\n28160 = N 2 0\n28224 = N 3 0\n28352 = N 4 0\n28800 = N 3 0\n28928 = N 2 0\n28992 = N 3 0\n29184 = N 3 0\n29312 = N 2 0\n29376 = N 3 0\n29504 = N 4 400\n29952 = N 3 0\n30016 = N 4 0\n30080 = N 1 0\n30144 = N 2 0\n30336 = N 2 0\n30464 = N 1 0\n30528 = N 2 0\n30656 = N 3 0\n30720 = N 1 0\n30848 = N 2 832\n31808 = N 1 0\n32000 = N 0 0\n32064 = N 1 272\n32384 = N 0 0\n32448 = N 1 0\n32576 = N 2 512\n33152 = N 3 0\n33216 = N 4 0\n33344 = N 3 0\n33408 = N 2 0\n33536 = N 1 0\n33920 = N 2 0\n33984 = N 3 0\n34112 = N 2 0\n34176 = N 1 0\n34320 = N 0 0\n34320 = N 2 0\n34320 = N 3 0\n34320 = N 4 0\n34320 = N 6 0\n35072 = N 2 0\n35136 = N 2 0\n35264 = N 3 0\n35472 = N 1 0\n35472 = N 4 0\n35472 = N 6 0\n35648 = N 1 784\n36480 = N 2 0\n36672 = N 2 0\n36672 = N 4 0\n36672 = N 6 0\n36992 = N 0 832\n38016 = N 1 0\n38208 = N 0 0\n38208 = N 2 0\n38208 = N 4 0\n38208 = N 6 0\n38592 = N 2 0\n38592 = N 3 0\n38592 = N 6 0\n38736 = N 2 0\n38784 = N 1 0\n38912 = N 0 0\n38976 = N 1 0\n39104 = N 2 256\n39552 = N 1 0\n39744 = N 2 0\n39872 = N 4 208\n40128 = N 0 0\n40128 = N 1 0\n40128 = N 2 0\n40128 = N 3 0\n40128 = N 4 0\n40128 = N 6 0\n40512 = N 1 0\n40640 = N 2 256\n41088 = N 1 0\n41280 = N 2 0\n41408 = N 4 208\n41664 = N 3 0\n41712 = N 4 0\n41760 = N 3 0\n41808 = N 2 0\n41856 = N 1 0\n41984 = N 0 0\n42048 = N 1 0\n42176 = N 2 208\n42432 = N 1 0\n42560 = N 4 208\n42816 = N 3 0\n42944 = N 1 0\n43008 = N 2 144\n43200 = N 4 0\n43328 = N 2 0\n43392 = N 3 144\n43584 = N 2 0\n43712 = N 0 0\n43776 = N 1 144\n43968 = N 2 0\n44160 = N 2 0\n44288 = N 3 0\n44352 = N 4 0\n44496 = N 0 0\n44496 = N 1 0\n44496 = N 3 0\n44496 = N 4 0\n44496 = N 6 0\n44736 = N 2 0\n44736 = N 3 0\n44736 = N 6 0\n44928 = N 3 0\n45120 = N 3 0\n45312 = N 3 0\n45504 = N 3 224\n46080 = N 3 0\n46144 = N 4 656\n46848 = N 4 0\n46976 = N 3 0\n47040 = N 2 0\n47136 = N 4 0\n47184 = N 3 0\n47232 = N 2 0\n47360 = N 1 0\n47424 = N 0 0\n47552 = N 2 0\n47616 = N 3 0\n47808 = N 1 0\n48000 = N 3 0\n48192 = N 0 272\n48576 = N 0 0\n48576 = N 1 0\n48576 = N 4 0\n48576 = N 6 0\n48896 = N 4 0\n48960 = N 3 0\n49024 = N 4 0\n49088 = N 3 0\n49152 = N 2 0\n49280 = N 1 0\n49344 = N 0 0\n49472 = N 1 0\n49536 = N 2 0\n49600 = N 1 0\n49664 = N 2 0\n49728 = N 3 0\n49856 = N 4 208\n50112 = N 3 0\n50304 = N 3 224\n50624 = N 0 0\n50688 = N 1 0\n50752 = N 2 0\n50816 = N 3 0\n51008 = N 4 736\n51840 = N 3 0\n52032 = N 2 0\n52160 = N 0 0\n52224 = N 1 0\n52352 = N 3 208\n52608 = N 2 0\n52736 = N 1 0\n52800 = N 0 0\n52928 = N 2 0\n52992 = N 1 0\n53120 = N 0 0\n53184 = N 1 0\n53312 = N 3 0\n53568 = N 0 0\n53568 = N 2 0\n53568 = N 3 0\n53568 = N 4 0\n53568 = N 6 0\n54144 = N 3 0\n54192 = N 4 0\n54336 = N 3 0\n54464 = N 2 0\n54528 = N 1 0\n54656 = N 2 0\n54720 = N 0 0\n54784 = N 1 0\n54848 = N 2 0\n54912 = N 3 0\n55040 = N 2 0\n55104 = N 3 0\n55232 = N 4 0\n55424 = N 2 0\n55488 = N 3 0\n55584 = N 4 0\n55632 = N 3 0\n55680 = N 2 0\n55808 = N 3 0\n55872 = N 2 0\n56000 = N 0 0\n56064 = N 1 144\n56256 = N 0 0\n56384 = N 4 0\n56448 = N 4 0\n56544 = N 3 0\n56640 = N 4 0\n56736 = N 3 0\n56832 = N 4 0\n56928 = N 2 0\n57024 = N 3 0\n57120 = N 1 0\n57216 = N 3 0\n57312 = N 2 0\n57408 = N 3 0\n57504 = N 2 0\n57600 = N 3 0\n57696 = N 0 0\n57744 = N 1 0\n57792 = N 2 0\n57888 = N 1 0\n57984 = N 2 0\n58080 = N 1 0\n58176 = N 2 0\n58272 = N 1 0\n58368 = N 2 0\n58560 = N 1 0\n58688 = N 0 0\n58752 = N 1 0\n58880 = N 2 0\n58944 = N 3 0\n59136 = N 2 0\n59264 = N 1 0\n59328 = N 0 0\n59456 = N 0 0\n59520 = N 1 0\n59648 = N 2 0\n59712 = N 3 0\n59840 = N 4 480\n60416 = N 3 0\n60608 = N 4 0\n60672 = N 3 0\n60800 = N 1 0\n60864 = N 2 0\n60992 = N 0 0\n61056 = N 1 0\n61184 = N 3 0\n61248 = N 2 0\n61376 = N 3 0\n61440 = N 1 0\n61568 = N 0 0\n61632 = N 4 0\n61760 = N 3 0\n61824 = N 2 0\n61952 = N 1 0\n62016 = N 0 144\n62208 = N 1 0\n62336 = N 2 240\n62624 = N 3 0\n62784 = N 4 0\n63104 = N 2 208\n63360 = N 3 0\n63488 = N 4 0\n63744 = N 1 336\n64128 = N 3 0\n64320 = N 4 0\n64512 = N 3 0\n64640 = N 2 0\n64768 = N 4 0\n64896 = N 3 0\n65024 = N 2 256\n65600 = N 1 160\n65856 = N 3 0\n66048 = N 1 0\n66240 = N 2 144\n66432 = N 1 0\n66624 = N 2 0\n66752 = N 0 0\n66816 = N 1 0\n66944 = N 2 144\n67136 = N 1 0\n67328 = N 0 0\n67488 = N 3 0\n67584 = N 4 0\n67680 = N 3 0\n67776 = N 2 0\n67872 = N 1 0\n67968 = N 0 0\n68064 = N 4 0\n68160 = N 3 0\n68256 = N 2 0\n68352 = N 1 0\n68448 = N 2 0\n68544 = N 0 0\n68736 = N 0 0\n68736 = N 1 0\n68736 = N 2 0\n68736 = N 3 0\n68736 = N 4 0\n68736 = N 6 0\n69248 = N 2 0\n69248 = N 3 0\n69248 = N 6 0\n69312 = N 2 0\n69440 = N 1 0\n69504 = N 2 0\n69632 = N 4 0\n69824 = N 3 0\n70016 = N 1 0\n70080 = N 2 0\n70080 = N 6 0\n70208 = N 0 0\n70272 = N 1 0\n70400 = N 4 0\n70464 = N 3 0\n70592 = N 1 0\n70656 = N 2 0\n70784 = N 3 0\n70848 = N 1 0\n70976 = N 2 0\n71040 = N 1 0\n71168 = N 0 0\n71232 = N 1 0\n71360 = N 3 0\n71616 = N 2 0\n71808 = N 0 0\n72000 = N 0 0\n72000 = N 2 0\n72000 = N 3 0\n72000 = N 4 0\n72000 = N 6 0\n72128 = N 0 0\n72192 = N 1 0\n72320 = N 2 0\n72384 = N 3 0\n72512 = N 1 0\n72576 = N 2 0\n72704 = N 3 0\n72768 = N 0 0\n72896 = N 4 0\n73088 = N 3 0\n73152 = N 2 0\n73280 = N 3 0\n73344 = N 2 0\n73472 = N 3 0\n73472 = N 4 0\n73664 = N 2 0\n73664 = N 4 0\n73856 = N 2 0\n73920 = N 2 0\n73920 = N 3 0\n74048 = N 1 0\n74112 = N 2 0\n74240 = N 0 352\n74240 = N 2 352\n74240 = N 3 352\n74688 = N 0 0\n74688 = N 1 0\n74688 = N 4 0\n74688 = N 6 0\n74880 = N 2 0\n75072 = N 2 0\n75216 = N 2 0\n75216 = N 3 0\n75216 = N 6 0\n75392 = N 1 0\n75584 = N 1 784\n76416 = N 2 0\n76608 = N 2 0\n76608 = N 4 0\n76608 = N 6 0\n76928 = N 0 832\n77952 = N 1 0\n78144 = N 2 0\n78272 = N 4 208\n78528 = N 3 0\n78576 = N 4 0\n78624 = N 3 0\n78672 = N 2 0\n78720 = N 1 0\n78848 = N 0 0\n78912 = N 1 0\n79040 = N 2 256\n79488 = N 1 0\n79680 = N 2 0\n79808 = N 4 208\n80064 = N 3 0\n80112 = N 4 0\n80160 = N 3 0\n80208 = N 2 0\n80256 = N 1 0\n80384 = N 0 0\n80448 = N 1 0\n80576 = N 2 256\n81024 = N 1 0\n81216 = N 2 0\n81344 = N 4 208\n81600 = N 3 0\n81648 = N 4 0\n81696 = N 3 0\n81744 = N 2 0\n81792 = N 1 0\n81920 = N 0 0\n81984 = N 1 0\n82112 = N 2 208\n82368 = N 1 0\n82368 = N 2 0\n82368 = N 3 0\n82368 = N 6 0\n82944 = N 0 0\n82992 = N 1 0\n83040 = N 2 0\n83040 = N 4 0\n83184 = N 3 0\n83328 = N 2 0\n83456 = N 1 0\n83584 = N 1 0\n83584 = N 2 0\n83744 = N 0 0\n83904 = N 0 384\n83952 = N 1 336\n84000 = N 3 288\n84384 = N 0 0\n84384 = N 1 0\n84384 = N 2 0\n84384 = N 4 0\n84384 = N 6 0\n84608 = N 3 1792\n84608 = N 4 1792 '
# Go through Invincible Song timestamps
time_bitset = defaultdict(int)
for line in invincible_notes.split("\n"):
time, _, _, bit, _ = line.strip().split(" ")
if bit != "7":
time_bitset[time] |= 1 << int(bit)
# Go through Invincible events
time_letter = defaultdict(str)
for line in invincible_events.split("\n"):
if "lyric" in line:
time, _, _, _, letter = line.strip().split(" ")
time_letter[time] = letter[0]
# Build pattern to letter lookup table
pattern_to_letter = {v: time_letter[k] for k, v in time_bitset.items()}
# go through Monsters, Inc song and look up all letters
tb = defaultdict(int)
for line in monster_notes.split("\n"):
time, _, _, bit, _ = line.strip().split(" ")
bit = int(bit)
if bit == 6:
# once you find the "6th note set" bit, print the letter. ignore stuff after.
print(pattern_to_letter[tb[time]], end="")
if bit < 6:
tb[time] |= 1 << bit
```