all right is it working now is the big question it does say live unstable it says a oh session says 27 seconds seems like it's working working now little Annie is here my biggest fan always coming to you mirrored well unmirrored today because you have to be able to read my t-shirt anyway how are we all doing today a little Annie how is my sound I changed some sound settings can you tell me how I sound is no response okay let's see what we are doing today let me do day day 17 day 17 oh little Annie just subscribed I hope she gets her money's worth I think she does input example and then we open up day 17 here we do close others we close others here we drag this example we drag the input close example okay I don't mean where you tell language language 21 and what is going on sounds sounds good ah sounds sounds good good nice let me check okay so we're going and today we were streaming for three hours yesterday it was a hard problem but that's how it is we ended up having a getting a hint from Reddit I hope we don't have to do that today but you never know okay this is so state-based right we're always calculating some sand state updates let me see what the input is okay this is the input okay let's see here I can't even copy it like now let's read the story I had the last book at the Elton reaction okay for you in the elements ground is rumbling continuously now but the strange valve bodies on time it's definitely getting warmer in here though it sounds imagine you open it on our chamber large oddly shaped rocks are falling at the chamber above doesn't lead you to all the rumbling if you can't work out where the rocks will fall in the edge you will be crushed the five types of rocks have the following because you should for hashtag is rock and dot is the empty space okay it's almost Tetris let's say paste this here okay rock falling order shown above first the cling then the dash and then the plus and then this one and illiterate the same order repeats J phones first six eleven sixty okay the rocks don't spin but they do get pushed around by jets of hot gas coming out of the wall so quick scan we will expect a bunch of August as a phone in jet patterns left means a push to the left while I write means a push to the right in the pattern means that the jet will push a phone on the right right right right then left left right left then sounds okay if the analysis reached it repeats the tall vertical chamber is about is exactly seven units wide each rock appears that it has a left it's two years away from the left wall and it's bottom edges three units above the highest from rock in the room or the floor what is the where's the floor right rock was one unit okay rock was one unit causing it to come to rest okay this is a use the recollection simulate this so where is the floor three units above the highest rock in the room or the floor if there isn't one okay let's see so I mean the one way to do it would be to so each rock will fall three units right until possibly hitting something below okay so you just have to check whether after three units of the current shape whether it will intersect with one of those we will dig up a range code again okay no data input today it's just I list of boom instant instance show input where no let's just have it in the show input where show I true is gonna be right anything is left instance read input where read crack is equal to parse break parse break break I always forget what I call that function first break it was choice char return true which are left what is wrong with this now okay so I want this parse here to be wanted the parse city should take char return read be I feel like that is exactly what I wrote maybe I screwed up something right on the right was true okay line input did I not push 60 or have that there okay well this is not line input actually type is the same read input gonna be oh my god you heard it here first my paper got accepted oh my god yeah I'm going to Ireland that might not sound exciting to all of you but it is exciting for me because yeah I'm happy that paper is out I'm really happy let me say paper accepted okay hmm can you see the reviews I gonna let me just take a quick break sorry dear fans I have got to see what my scores were if it barely made it or not but you know it doesn't matter it did make it that's all I want for Christmas is a paper acceptance you know how it is you're in the biz this day nice can I see the nope no reviews haha maybe I I don't see any scores either I would have liked some scores ah what a good good news great good news because this was one of those times paper got accepted to my cst okay Augustine my good friend boy we're going to Ireland I'm gonna have some Guinness what what whoop whoop spectacular yeah that is the name for the paper haha yeah yeah I mean they wouldn't send out the acceptance email yeah okay I mean I don't know Augustine is very negative I'm not I'm I don't think they would send out an acceptance need a little a amazing where can I see up reviews reviews they seem to not be at the end of the message yeah they're not at the end of the message if yeah if this is a screw up I will be devastated but it's funny though that easy chair it's funny that they don't the reviews are let me see you yeah because like on a paper that got you eventually accepted in easy chair I did get the reviews before like with the paper but now they're not there huh strange not on the website anyway hope this is still valid I would be so sad to get the acceptance letter and then find out no it's been rejected because well anyway okay let's hope it works out anyway I'm glad you're all here to celebrate this partial victory even if it might be wrong okay let's go okay so let me first of all we have this input here who think but as maverick and then I want to say because it's like I'm reading a list of characters all right let's see a GT oh day 16 now day 17 day 17.HS and OXC and you gotta time it no input files this one is supposed to be oh okay we parse the input boom so first of all I want to create a function that calculates the net effect in n steps okay in fact takes a list of inputs and returns an int a net effect if if it's I true let's actually not say I true here let's let's say let's have these be ints and int 1 is right and then it's gonna be 1 this is gonna be minus one can I do net effect equals lift co-coords can I do that some dot co-coords because it's just a wrapper import data dot co-coords no it's not because it's not a new type but what if I make it a new type new type what if I say okay net effect is some map co-coords okay and so first when a block falls it has it will go down three okay now let's look at these blocks so these are essentially two ranges this is a range from zero two three this is a range a so this is the X this is the range and let's have it actually doing is why from one to one this is a okay so let's say blocks list of range there's got we got so much range code here it's crazy cruck cruck cruck crazy oh this is an oblong language that day here we have range okay now we did we had a merge range somewhere yeah we had it in utu merge ranges that's right type range in command goes from range to range range to range to maybe range merge ranges is actually range to but now we export range also here type range I think okay now we're working on here blocks is a list of ranges blocks pair of ranges blocks equals zero comma three zero comma three two and one comma one then it's a range a I also need the X coordinates of the ranges the reviews are there and we got wow reviews are there okay we got a two week accepts and an accept whoop whoop whoop whoop whoop whoop whoop Guinness bro so happy I'm so happy okay all right all right I don't know it's always the papers that I'm like I don't feel like like I feel like we could have done better those are papers that I write that get in anyway very nice very very very nice okay how do I represent these actually I usually don't actually care about the and okay let's represent these and as a list of why coordinates I guess it's important in map the board a qualified in map as I import this data dot in and then this is just I am dotted in map import data dot in map in map in map range okay so the first one is I am dot from least we're just gonna count from the bottom 0 2 3 I am dot from list this is gonna be a 0 a one from one but they always start let me see they always start each rock appears so that his left edge is two units away from the left wall okay so we'll start at two right so this is gonna start at dot dot 2 34 and then yeah it starts at 2 2 a 0 1 2 3 4 5 yeah 2 2 5 this one a actually starts and yeah so this one is 2 1 2 1 2 1 2 and then 1 2 3 it's gonna be like this as it goes so 0 is starts at a 3 2 3 okay a 1 starts at 2 2 a 2 2 4 and then 2 is 3 comma 3 again okay fourth piece I am dot from list a 0 starts at 2 2 okay same three size but then this one has a 1 and that starts at 3 comma 2 comma 2 like this at all and then it has a 2 no this is actually 3 comma 3 right a minute so this is 2 3 4 you have 4 comma 4 3 4 comma 4 these are the blocks and this one is just a dot from list let's keep it like that some documentation okay and then we have this one which we're doing now and then we have this we have this final one this one is just gonna be a sip 0 2 3 wait a minute this one should not be it should be 0 1 no 4 4 yeah it's 1 2 long 0 2 3 and it's gonna be 2 comma 2 and then it's the last one here this is actually dollar repeat and the last one is 0 2 comma 3 okay we got all the blocks do print map m okay so we're always gonna go down gonna calculate the net effect out of three steps so let's say a simulate okay we're gonna say a lot of steps we're gonna make a list of the effects we're gonna do take a block is equal to map range and put an int map block simulate a falling so steps just able to okay where as equals take the steps can i make i want to make this is like a cyclical list now let's and stop with that for a moment okay we can actually cycle this list take steps cycle jets let's actually f a k steps a cycle jets yes f this is gonna be f a a a rest let's add steps cycle jets now a nf equal nf equals a net effect of f okay and then uh i can't just do the net effect right because if it like bumps into the wall like any further push to the right will be ignored but then to the left will be there still i like it and they didn't really have so many huge comments about like what we need to fix before the camera ready it's more like change the title because i mean we were selling it then it's just like okay let's just simulate one input i'm serious block let's do it super naively okay now let's say block we're not gonna split we're not gonna do this net effect we're we're gonna do it extremely stupid the first time max max block to int okay so then we do max pl equal i am dot lm's lm's a map s and d max a chord maximum minimum this is gonna be minimum mini mom else maximum else okay okay so uh maybe equals bounds of block so how do we simulate one step we do it simply we say a if a mb a m min b max and b if min if e and so let's just do a equals if case e larger than zero then and if e is larger than zero and max let's just see say if a if max b if e larger than zero and max b plus e less than less than seven and then we want to do a then add block int block block add block okay so this is one step okay so um ebl okay map with key and map with key i want to say like a just or something like a just kind of like a map monotone to the key map key okay i think i just have to do equals where the bls equals a map dot socks pl and then i want to say a bls prime equals a map so i want to take this is the key and this is a comma b now i want to take each of these to k plus one so k plus one a plus e a b plus e equals map dot from ask list of a this map function of map dot a socks okay so if this holds then add step e e is less than zero and min b plus e is larger than zero and you're equal to zero let's just do this one one way or it's gonna be wait what is the block block the list of ranges right okay uh we're still going today but i'm just okay so this is add step so now i actually i don't care so what i want to do is i want to maintain like a list of the highest blocks okay so so a initial floor is a list of ints initial floor equals a replicate seven what i want to replicate is three because it starts off at so this is zero then this is one two three okay it starts off at four so this is a list we're gonna maintain right like a what is the highest maybe i want to model this like so it's not not a list of like these coordinates but maybe this should actually be a sequence uh let me say data import data sequence are like these things that sequence has go that allow you to like finite sequence and they can be you know go left or right okay import data dot sequence seek import qualified we want to see now i'm not gonna model the block as it is i'm gonna model them as the list of highest coordinates for all of them okay so this is gonna be seek dot from list there's gonna be a list of seek of int all of these okay now this is gonna be sequence from list so zero okay okay now one kind of a model okay let's have it maybe this is gonna be slower but let's just do that way so this one is nothing nothing then just zero just zero zero nothing nothing just zero just zero let me write this better way where n equals nothing j equals just okay a just n comma n comma j zero j zero j zero j zero j zero comma and okay that's this one this one is seek dot from from list this one is a n comma n comma n comma j oh no this one j one this is j j zero one two j two j one and come on okay this one also starts off here dot dot this one is n and j oh no this one's jbj one j two j one j two and then you know it's assumed that uh it's assumed that anything underneath is zero it's just the right way to do it i don't know and j zero g zero and then one two three j a two let's see this and then j a three come on so what i want to do is maintain the floor and then i want to i mean i think the key thing you're doing here is we're just maintaining the floor okay sorry i'm going to take a quick break sorry about that i was just too excited to get it out of my system okay uh what am i trying to do here okay so what i want to say so i want to check whether something impact okay so let me just like keep this this is like a list of the how the impact affects how the impact affects the floor so let's just have this be a list of maybe let's not do this this sequence thing okay remove this stick here okay so and then one j three so here's your one two three and then these are not the ones i'm gonna so it's nothing nothing nothing nothing it's just and one just and and and now okay let's do it the other way so when this hits the floor it increases the height by this when this hits the floor it increases like this so this one increases by it by nothing i think one one increases the height by uh but it's not like this it's like this yeah oh i should hit like this increases the height by one and one and then three this one increases by nothing and it increases the height by max height by two and then by three and then by two and then nothing nothing and this one increases the height by one one one one okay so uh and then this initial floor replicate seven a a just a zero yes zero okay and now a okay let's just ignore that for now and now let's say a increase increase increase uh maybe in stops so stops uh block floor equals new of floor prime where we're gonna do a this is actually sip width uh block floor and the function here is i feel like there's some ggi so let me see here a so if i do f map plus a if i do right okay so let's just see here a a bump this is just bump bump block floor where a bump of just a just j equals just i plus j bump a nothing so nothing and just but not anything a j equals j and a just j equals j i can do bump nothing nothing and anything equals anything and then bump bump anything nothing equals something so this is a when i when i when i when it stops bump and print and block so let me compile this again so let's see if the first one here when it hits the it comes to rest okay and wait it's a one two two three four five and it just so happens that it yeah okay that then print and blocks and let's do print stops a blocks zero a initial floor so let's say print initial floor when it stops yeah it bumps up by one and then grab push left right left right left one unit here guys push rocks but right again then it comes to a stop so this block two one okay then a we print stops blocks one dollar yes you're just here just three four three one yeah so it becomes zero one two uh just two just three just two not nine okay and this is zero yes and then this is one two and three and four and two and three okay now we have the floor let's release all these blocks block stuff and let's call this maybe in okay now initial floor okay and stop and this one takes in a block okay now let's say a block the block of a block start we need the index of the block we need the start of the block and we're gonna get a block block start the block number i and we're just gonna do i mod whatever we're just gonna get zero one two three four blocks yes four types of blocks yes so a block key and then start equals okay so we're gonna do where block is equal to blocks a block the mod that's the block and then start we're gonna do a what if i do like yeah i'll just do this is f map plus start yeah we're gonna do map f map plus start so if there's something there then we now let's do block step again it's gonna be an input input a okay so let's do here i e case e so we will have the l add just something and then rest okay c less than zero equals b f step i e and b l we do anything just anything nothing this is why i want to block the b sequence yeah okay maybe it map okay we have these we'll not be very happy about this right a sequence okay so if the sequence a b l just if the b l if it starts with just something i need to do colon okay if it starts with something and then we just return the block now if it starts with a nothing that's equal to case e less than zero is equal to a r and it's not the pattern for these patterns see let me see here and the block step here okay okay so this is how it works for the if less less than zero and now otherwise it's essentially the other way we check if it ends in a just something and here's e is bigger than zero that this is gonna be the same as the b l right if doesn't have an effect block step i e and then if it ends with nothing it's equal to nothing and i add nothing to the front of it okay a map f map start b l um this is probably just see okay and then all right so simp with just see pav sip okay it's simp with a zip dot sips with and then this is initial floor has to be big dot from list okay now this is when it stopped now i want to look at the collision collides and block two now collides so nothing a anything is equal to collides then this is f is equal to collides b a collides same for the other one so just anything be nothing the floor will always have something so we don't really care about this yes but let's just have it there f equals collides a b f now collides a just i just just j case so when do they collide well they collide when the floor is well bigger than equal to true otherwise okay so now now let's check here and now that's what the simulate function okay simulate a we have the block and let me just let's have a color block and let me have the uh let's actually have the floor here floor block to a this input to floor this is one step okay simulate a f l a b l a so this is a imp imps okay now we do a a case collides and uh so first we have to do we'll do a block a pl prime is block step imp bl okay if a case collides uh so this be block and collides a this is actually floor and okay collides a a block prime floor is equal to uh stops is equal to um stops stops a b l f l well that's actually b l f l okay okay okay let's do it like this okay wait where bl prime equals block step in bl because otherwise you use it uh collides bl f l yeah this is gonna be the stops here otherwise we requires otherwise a we have this be the sequence of inputs actually seek input otherwise a collides otherwise simulate f l bl prime imps and we add it to the black okay so now read input print let's do imps let's go to read input and let's actually uh seek not from this okay so now we have the sequence okay so now let's simulate the first form let's simulate a simulate print simulate initial floor block zero simulate blocks zero let's have the pattern in collides right collides but there's nothing left of the sequences and they don't collide uh block step a imp pl okay right this should be actually block start and we will do it starts at four and this is block number zero and block step and we have to do f map f map plus one f map f map in here f map f map plus one uh let's just that's not over complicated a block step let's call this block step also f map less one a dollar dot block step a i b okay it just keeps going this should be block start actually zero and four it just keeps falling while it doesn't keep shifting to the right simulate f l prime collides bl prime a let me just check so it collides if the floor um right so i start at the top and then i'm going down wait let me increase the floor this one should be a actually this is one block step okay so first one zero zero one one one one okay okay let's do uh it's gonna be the steps and this one is still steps uh okay so if it stopped when we stop the floor okay so simulate so after now 222 blocks have stopped okay so let's have this actually let's be kind of cool about it and that's uh now we don't care about it okay um so simulate num blocks okay so if it collides we stop so then um let a floor prime equals home this is a new floor in uh simulate and num blocks plus one f l prime and block start a n b prime equals num blocks plus one n b n b prime then a max block equals the maximum of cat maybe's a seek dot dot from list uh two list a this is max block plus four okay and uh when it doesn't like cat maybe's a qualified data pool f l dot two list and then import data dot maybe cat maybe's ding ding ding floor prime block start okay and then it's prime now let's set the maximum simulate num here equals case num block equals 2022 2022 2023 uh is equal to uh no 2022 is equal to floor now let's simulate for zero okay that didn't work it went very high very fast though me me meeting me where does it get stuck i feel like it gets i can learn block like trace show um block it seems to have rolled over do do do do do do a block 88 notice uh because uh yeah so because when it hits the floor i'm not and i should not be so when it stops it should not be the block it should be the it should be the block type okay so collides okay now this is all wrong also this one was only for a checking whether it stops now but i want to check in so when it stops so i kind of want to be checking for the like the bottom parts but when it stops i want to pick the maximum part so many photos okay let me see do okay and the same also the collision is correct block start is correct but when it stops stop is correct but collides let me see because the collides is not correct for like the other blocks these are for when they stop they should be they should pump it up like that this is the problem with tracking only one end the block step is correct okay block step is correct for the lowest part okay so um this block here this is one the one we're gonna track is thinking if this is thinking about the lowest type okay so we're gonna say block start here so uh blocks let's uh copy this and let's say block block this is blocks okay for the end block a block okay block bots bots so this is the block bottom so the this one is correct now this one the the bottom but then when i got one one one one one is the so zero zero zero zero uh yes i think it's gonna be uh no one one one is here so this is gonna be one oh no one two okay and then one and two and this is gonna be one one one and this is gonna be one and this is gonna be a one one okay and then the block start here is like block bots modeling block bots this is the starting block uh we started to bump it up by four and okay and it should really start by so okay so it is zero sorry it is zero let's see look at this picture right so because it's zero the floor is zero and then this one zero one two three four okay so this one should be actually be zero here or no let's just say that they they add a max block plus three block start three zero three okay map print block i don't want to print the blocks anymore okay um now we're transforming the block and we're moving it around okay and the only thing that changes here is that the actual like when it stops when the block stops it's not the top of the block uh okay yeah floor prime it's actually just gonna be uh we need the current location of the okay so i know the transformation the block bots okay now block tops it's gonna be but let's this is gonna be a bit funny uh this is actually gonna be a list of functions okay and it's gonna be a list of functions okay and this function here it will bump by so the first function actually will not do anything either the second function so we're now looking at this one here it should take two one two two two three two a so this one is gonna be a let's see let block btf okay a so it takes a uh block nothing so it takes the the so it has the f's here and it has a sort of further nothing they just get is equal to btf fs r uh btf fs uh f fs uh something r is equal to okay yeah so this is gonna be nothing btf rs this is gonna be at uh f i no f i yeah applied to let's do like that no then if i apply to btf fs r okay and so i apply the functions no btf anything and then this is gonna be like an empty empty sequence is equal to our under a function i just return the other seven sequence so this is gonna be a four ins replicate a four id block tops replicate for it so this is gonna be just return them four times now this one is gonna be a so now i want to uh so the first one it's gonna be a it's gonna be eight then it's gonna be f map plus one plus a sorry f map plus two and then eight okay this one is gonna be a eight eight f map plus two sorry a btf and then this one is gonna be btf f map plus three and this one is gonna be btf f map plus two f map plus two btf replicate to f map plus two no how insane is this 46 and it doesn't compile in okay boom okay so block tops okay so block tops so what i want to do here is this is and then we go a btf uh no we go uh block tops so bl tops equals a there's gonna be block tops bang bang num block mod and num blocks block bl top is gonna be bl top f bl let's just simulate a let's simulate not so many a let's simulate one only wrong list uh just zero just zero just zero just one one just one just one just one two two two two two two that's not correct uh the first rock begins falling okay let's just see what does it say right at the end the floor starts off like that okay and that's a trace show id here trace show id okay so it starts off at zero zero okay this is the initial floor yeah and then nothing nothing nothing so it goes the right and it goes down and then it goes to the right and it goes down and it goes to the right and then it goes down okay and rock falls one unit pushes rock right nothing happens right nothing happens rock left rock falls one unit causing it to come to rest did it get us pushes uh okay maybe um it's like i'm trying to do too much or like i'm missing one step yes i am missing one step because this one will about be imps prime it will be imps right okay so block stops and then but first i'm gonna do but i'm gonna f map i'm gonna undo the x minus one that didn't work out yes to undo i do f plus one okay and now i'm gonna just four just five just four just one let's see just here just zero okay just four so zero one two up zero one two three it should be three four three right two one yes the floor is not correct here okay it seems like that the jet pushes and then and then we do the check maybe the block tops motion is wrong for the second one and here i do because it shouldn't be adding it should be taking the max here no actually just just be fine three four three one okay three four three one and then a new walk between folding let's see what it is for three so four four six three one let's see zero one two three four four zero one two three four five six so four four six zero one two three four wait so zero one two three four three one four four seven three one four four one two three four five six seems like this one didn't get achievement or something like that taking long today I feel like you know even though we're just kind of doing the very basic very basic stuff it's still taking a long time I feel like I'm also distracted by the whole paper getting except let me check one more thing oh there's something wrong in this simulation yeah I think it's mostly the simulation this one is correct so floor prime is correct let's just actually BL top F no yeah okay so here and it was just four and then just three and then it collided just four and then just three and then it collides nothing nothing nothing just three yeah there's nothing there's nothing nothing nothing just three nothing nothing there's something wrong with the actual like the I think maybe yes okay but a collision function is correct definitely it stops is correct but there's something wrong with the in a way we simulated okay so let me see okay so I think we have to do a block a block this is just just be jog jet block step block jet this is just block jet okay then we're gonna see exactly the definition so here so uh rock begins falling then jet happens and then it falls if possible okay so the simulate okay so be so it's bl prime the block and jet so this is we take the current block and we apply the input okay so now we check the collides f map and so let's just say fall is equal to f map f map minus one minus one let's say a falls block to block falls equals f map f map x x minus one so let's see the collides of the next one so it falls collides falls of the l jet floor so if the next one if the if it would collide then we stop it it stops the l jet a floor and then we go the l the l top the l jet be frame max block okay and then we now we simulate the one next time in sprites this is simul otherwise we simulate falls bl jet okay this one ends up at the right spot more close one you're very very big and it ends up in the right spot now let's see the second one there's three four three just one okay yeah just three four three okay and then this one falls number three just four four six four four six three one okay now moment of truth just four four four four four four six let's actually see here what the floor prime is see please show it what was the what were we adding to the floor uh trace show because you printed out like this okay uh okay let me see the uh let's see the a bl let's see a bl jet and bl top at the top of bl jet the bl jet seems to be okay let's always okay so i found three two one okay and then it collides and then it doesn't change and then this is only one so then it's a six five six six five six goes to five four five and then four three four and then three two three okay and then it so the next one would collide uh so we say okay so it becomes three four three yes and then that's a new floor okay so just eight oh just eight just eight just eight yeah so these are the bottom ones yes i'm just okay just five five five just three and then just four four four and then we pump it up and then six okay now this one starts so the tallest one here is six so it starts at just ten let's see that so zero one one two three four five six seven eight nine okay this one starts at ten and then it hits and it goes down to nine and it goes to eight just a seven and then it goes to just six so this is the track right it falls so it's at just six right and then it blows to the left but won't so it's like here but then it blows to the left and won't move because it's a because of this one so this so this a block jet it actually has to take in the floor as well okay so this is the let's just make this into the so true this one just says false okay so if you can't blow here here it can blow and this is false and then this is true okay so a block jet a this is actually a hits bound then we do a case a hits bounds i i b if it hits a bound then which just the block hits floor e hits bounds okay now hits floor lb is equal to b otherwise where so shift i so shift e so if it's at the front case e is less than zero is equal to r r i shift e we have at the other end e is larger than zero is equal to i okay shift anything anything close error okay otherwise i'm defined the hits floor now let's see hits floor this is slightly difficult okay now e let's let's say that it's going to the left okay and we have here the we only need to check the right edge right then we say okay so here it's going to the left so we say okay this is going to be the floor nothing but it there will always be something on the floor just hi but also with the plus you might hit the floor yeah just r r a just j k a just i just j case okay e is less than zero so it's going to the left and j is is less than equal to i is equal to through f2 case e is less than zero uh because hits floor e f1 f2 hits floor e but it's not at the same spot okay just i k listen okay so i is greater than or equal to j just as this is a we have like the current one link and then okay go to the left of that one okay it's a case you see how's my camera doing okay this is very annoying this like i'm gonna take a quick break just stand up a bit stretch think about this uh i'll be right back see you in a so about that always good to stand up a bit okay let's nail this function it's like the only thing we have left and du du du du okay so first of all let me see blocks jet hits bounds so hits floor i just kind of want to get the okay let's write it for uh so just i to the floor and k and f1 the vertical to the left that's kind of easy right just j and then just j okay and then if this one is over that one uh so uh if uh yeah so so then here it hits otherwise we do we continue okay now so let's just say hits floor uh hits floor so we're gonna take this away we're gonna say hits floor where hits prime you're gonna be hits floor prime okay hits floor prime here we're not gonna call talk talk about the e you don't care about the e here uh okay otherwise hits for kf1 then we do hits floor prime anything else false false now hits floor e is greater than e greater than zero e k is e greater than zero is equal zero is equal to uh no this is when e is less than zero so it's going left then it's a it's actually yes hits lower prime um flb hits for prime flb b hits floor has type uh hits floor if a okay let me just say here hits floor can i just say hits floor otherwise we're just gonna do reverse okay seek not reverse or is fl otherwise hits floor prime seek not reverse fl seek not reverse b okay and what's wrong with this hits floor is full hits floor prime now and this one ah gonna be just uh be uh hits bound okay let's just have be here excellent ding ding ding ding bljad now bljad is gonna be special block yet and this was a floor right block yet takes in floor yes okay shift 104 ding ding ding ding no just zero just you're just nine just five just seven just one that's not correct either i'm very scared of this like a case where like the like the t kind of slots into the oh i feel like it's such a it's not a very interesting problem either right it's very right because you might have that case right where like sorry i forgot retransition hello and yeah we've been trying to do this but it didn't work so might have a case where you know like there's a t and it stands like this and there's another t on top of the t and then there's like one that goes jik right like falls in like that it will it will be like stuck but it will not uh we will not catch it right because you know the highest point and the lowest point will not work out i think we just have to um we just have to model it directly okay let's uh let's start from scratch okay a cp day 17 day 17 digest day 17 day 17 initial digest okay now we're just gonna delete all this and we might you know copy it back later but we don't now we're just gonna we're just doing too much premature optimization okay we're gonna keep the sequences for these okay and this is just gonna be return i true and return i false and then we're just gonna have you okay and then we're going to print and then we're gonna say okay but true uh we keep copying it oh no that means we deleted everything here also okay let's uh go back then now let's say okay and then we're just gonna keep this all block it's just gonna be a set of points no optimization at all okay and ding now we can actually ding ding ding ding ding ding so uh type of block is gonna be an int map of ints okay and we're gonna have the y coordinate and then we're gonna have the x coordinate okay now we have to rewrite all the blocks let's reopen day zero this initial okay um okay so uh blocks is a list of set of ints better now so let's the block okay and port data dot okay and port data dot int 12 okay we have int maps already blocks okay and we're gonna just look at the the annoying thing about these int maps is that you cannot okay we can change the keys okay a i am dot we had this all the way in the beginning map i am dot from list okay so the first one is just a zero comma zero a zip and then it's the so we're gonna have it like the yeah so it's the x coordinate and the y coordinate uh then it's not actually int map of int it's an int map of set of int okay a then this is gonna be y coordinate zero uh and then set out from list can i have like an int set yeah i probably have an int set import data dot int int set yes int set import qualified int set as is data dot int set uh int map uh int set okay and this is a is not from list i as from list a and then this is just gonna be zero and it's gonna be just zero two three we're not gonna be doing any clever modeling here okay this is the first block okay second block second block and third block we have the fourth block uh we two oh we have five blocks yeah okay now this one goes a we're gonna do it downwards okay zero comma a is not singleton and then one has is is not from zero to two and we have yes sorry these are not like this actually yes okay and then we have another singleton okay actually i'm just gonna copy this one for the next one this is zero zero a singleton two one is single singleton two well and two is from list zero two two okay this one is zip a zero two three of repeat is that single then zero oh and it's not a list actually okay and this one is zip zero uh one repeat is from list zero one like this is a list this is a list this is a list this is a list and this is a list uh sorry we'll come here okay let's print out the looks okay the action okay in vibe so we do the action so a shift right takes an int map in set to take a block to a block block okay and so shift right is equal to im dot a map s r where s r takes is a is a is dot a map map a monotonic this takes a this is and it just this one bumps to this is just a plus one shift light shift left shift left is equal to a dot map s l or s l is equal to i s dot map monotonic x x minus one okay that's how you shift right and you shift left so then we write the a which is right the right uh fall block to block fall is equal to a i m dot a l m snow a socks and so we do a i m dot from ask list dot a i m dot map x comma y to x plus one comma y and x minus one comma y pink pink pink pink and doesn't like this because uh uh this is not i am done this is our block falls and then we can shift left and we shift right okay a pink pink pink okay and now it'll do a um collision it takes a um yeah let's you just type floor is also an int map insert collision floor block bull collision f l block is equal to a then i just check if any of the sets a collide union with okay so the union so then we take um let me take the i m dot union with okay um okay we don't actually need here this f l field so now we're taking the union of the two all the points um and we'll do the union is gonna be a is dot intersection and we're gonna do is dot empty let's do better here so i am dot intersection but here we have the i am dot intersection and then we take the intersection um and we have a intersection oh yeah an intersection with okay so i am intersection i am dot intersection with okay and then we do so then we have the uh we have the floor blocks and the so this is here we do is dot intersection yeah and then we do is dot and it doesn't like this because pretty much uh actual block in pappin set in pappin set int map uh okay yes so now we have intersection uh and we want to check that all of these well empty uh inside let's go oh yogin brightner was working on this he is a legend uh okay well so we check whether the intersection is empty okay so that's what we're doing is dot this joint now i want to check so i have the intersection and then i have the disjoint and then i'm just gonna do the elements i'm gonna do a is i am dot l m floor uh in pappin set int map boom okay so this is the f l and the b l okay uh where uh is equals f l b l it's gonna be is is int map okay and i'm gonna say uh so i want to check that i want to see that they're all disjoint so i'm just gonna do and is okay so that's how we do a collision okay and this is like super over the top right but i was very tired of what we're doing before okay but i'm gonna say here all and i'm gonna say also bump a i'm gonna say a lift up int block lift up uh equals equals i am dot from ask list dot map a well map a y a x plus y a dot i am dot s ox comma y a y mod okay now and then all is actually just uh call is equal to y mod minus one now okay let's stimulate okay so initial floor is floor int l in initial floor initial floor is equal to a i am dot from list now i am dot single ten zero uh and it's gonna be is start from ask list uh from distinct ask list a zero two is the initial floor a from this that's how this one doesn't matter uh int map from can i remove it from distinct yes very good okay and i think because i'm doing all map non-targeting that i mean that this is all just views boom boom okay how is everyone doing by the way this has been a long stream i mean what we restarted right so and i've been taking breaks like that it's okay a okay now i have the initial floor and let's now write the simulate function so what we have this nice construction here we had like stop and collide and simulate okay simulate num blocks lower and then we have a current block and we have the input simulate uh intake input and let me actually do a render floor takes in a floor and returns a string okay a render floor okay we say here uh where max y is equal to a f help okay max y is equal to i am dot find max view whiskey find max max y comma i don't care about the value there i am dot find max f l check check a x comma y is going to be equal to uh first of all if a i am dot bang uh i felt a case a just a x is equal to comma is equal to x is we're going to x a is dot member x s equals uh otherwise equals uh false so i am going to do here here uh four m uh four a so this is going to be the y coordinates zero to max y and four a well axis go to zero to x so here's a six let's do import data dot fold double let us f l let's see here f l dot four a f l dot four a then we do x and i do if check x comma y and then hashtag else now what does four actually do um and these are going to be the this is going to be a list okay uh let l equal in l plus plus okay let's see four uh traversable sorry about that import data dot qualified a data dot traversable no let's just import data dot qualified no data dot traversable traverse and then this will actually be a flip traverse traverse zero to six eight dollar x and then i do all this stuff let l equals in l plus when it doesn't like this do let's just do it i o okay i don't care i o string i o four m a dollar y two uh four m six dollar x we do here a a put string if check to do uh okay x put string and then this is just a do and then here we do stir and then import control control okay now let me render the floor here render floor initial floor oh yeah uh render floor and we're actually gonna do it problem x y plus a plus four i'm going from the reverse i want to do this in reverse okay now if check x y then x is member x's and the initial floor oh yeah yeah yeah yeah because this is the floor okay so we're actually gonna do here uh one then we're gonna say and do this and then we're gonna say put l n a replicate seven this is the floor okay and then binging now simulate we get the in and the current floor and the block and the peak input return of floor okay simulate num block floor don't care don't care case num block equals four num block equals one is equal to four okay simulate num block floor and the current block we have this input imps okay so collides we're gonna say what happens first the first rock begins first rock begins falling okay the jettacast pushes the rock right we're gonna do a jet block to block jet okay input now jet uh i true so this is the right is able to shift right jet i false equal shift left so what are you gonna do here okay so first of all uh bl prime is equal to a jet input but first we shifted to the left of the right based on the input okay and then we check okay we always shifted to the right okay okay so where bl prime first bl prime is bl shifted is jet input of block now if it collides collision bl shifted collision and what was the condition here floor black okay collision bl shifted floor so bl prime is if collision floor bl shifted then so if it collides if we shift it it's we don't do it right else bl shifted okay um so let's we do this in all cases where we are shifted jet input okay so this is how the wind affected prime is equal to this we have collision bl for it okay now how we do uh fall so uh fallen a a a a down it's gonna be fall bl prime okay now we're gonna check a collision floor bl prime so here uh if if if going down one step after shifting then we do uh then we do this is a new one it's okay imps prime is equal to imps and then this is simulate num block plus one oh this is going to be supposed to be uh okay let's just say floor here simulate num block a one a we're gonna we're gonna do floor prime and then a new imps prime okay otherwise um okay let's do like this so down one is also always gonna have i mean it's always gonna be checked collision floor bl down one okay otherwise it's equal to simulate num block floor down one imps prime okay so but if there was a collision we add it to the floor right so now it becomes part of the floor the floor prime is equal to an i am dot union with iis dot union floor prime a floor bl prime and a new block okay so let's let's write the new block function new block takes in the a current number of the blocks and it takes in the current maximum y any returns of block so new block num blocks a max y is equal to um so the block is gonna be bl equals a blocks bang bang a num blocks mod link blocks and i have to say uh we're gonna mod the we're gonna shift it to twice to the right so we're gonna do um okay we'll just do like this blocks yeah we shift it to the right shift right color shift right twice to the right and then we do mod y and mod the y mod and we do plus max i plus four right so we're always gonna start a we're gonna start so uh so zero the one two two three four this is a new block function okay new block is equal to new block a num block plus one and how do we get the maximum y we do i am uh dot a so first of i am dot find max a floor prime it's gonna be the maximum y okay so then we're gonna simulate render floor now we're gonna do simulate are so simulate a we do the initial so number block zero a initial floor and the a new black zero and the fine max is zero new black zero zero and a right and then the imps render floor are let me print this floor sorry a print okay why did it do that mm-hmm so zero um zero two three four six uh oh yeah okay let me see it seems to be a collision maybe my collision function is incorrect this is going to be an intersection with let me show you here a ratio eight okay so it seems like it's shifted to the room so it was just for three three four five six okay and then it seems to have shifted to the left but it should be shifting to the right right uh shift right i'm wondering the shift left this left yeah this is why true okay and then yeah okay a uh true the right shift right okay we are shifting right left a didi didi didi trace show okay trace show it let's see gci any of the entry list is a oh end of the empty list true ah right so i want this to be uh let's i think this is should be then not this joint will be a okay and then there should be or okay a collision and so if any of these mm if any of these are let's just do it like that okay game fb okay and then we do not disjoint fb okay and then we say or so if any of them are not disjoint i think that should work so if any of them or so because uh or of empty list is false okay okay yes okay now let's see what we get yeah uh but it shifts to the right too much right okay so blocks initial floor collision so if collision floor bl shifted or ding ding ding ding ding a bl shifted so let's write the out of bounds function takes a block and return the ball out of bounds is equal to any we do actually im dot lm's of the block okay so we get all that so we get is dot unions is that unions and then we have a bl where is that union the bl and then is equals is that find miss a max is equals is that find i a min is less than zero max is is equal to start later like a little seven uh do do do do do do do do do do do do do do do do if collision floor bl shifted or okay and press your id okay so it does check the three four five six four five six seven and five six seven eight from list watch find max is what is three four five four it's not checking the maximum i didn't do this okay let's actually check the out of bounds first because that's probably more common okay so this was block one that seems to work now let's go for simulate for a so she restarted zero always i'm needing let's check what it does for number two yes we end up error right yeah okay now for three this one looks incorrect and it's probably because yeah because i did zero one two so i'll probably have this like zero zero one two and now let's see if we actually solve our problem to do this all i'm sorry okay this is the right picture bing bing bing bing bing let's write here a okay and now task one takes a list of inputs and it takes and returns and hint task one is equal to um simulate 2020 through 2022 a zero initial floor new block 00 and it's gonna say i am dot find next and we're gonna say first bing bing bing simulate it's complaining that uh c can put hint task one three zero six eight yes then i'm gonna say uh read input the 17 dot example okay but uh that was super quick right and and i feel like it's more limited not by the jets but by the actual rotate input non-exhausted patterns and functions simulate okay okay non-exhaustive patterns in simulate nb nb fbl i equals error show because i don't actually have anything in input v smart v v smart then it doesn't know what to do what is this okay 3166 maybe not that many more blocks right all right we got part one finally do this is a big number okay it might be probably really slow let's see task one so let's test go test go so i think what we should do here is we should prune this data structure of ours so kind of when we've hit when we hit e in a big length we should prune it ah let's just run it i don't care it's gonna be a long time uh yeah i can't really do the h-top here let me do the h-top on the other one what could happen here is that it just uh consumes all our memory that would be bad but i feel like these say you know intersection unions with things they are pretty good and well intersection with right uh oh and m plus m now we can probably change that so so for collision right we don't want the actual i feel like this should be not m plus n it should be like the minimum a it should be the minimum three strings okay at least you know we know that this will work right but it will take a long long time and unless we can somehow prune it we're also running it for the example as well just to see it but um it's going to take a super long time for the example and yeah see now we're starting to run out of memory let's kill it and uh i want to see what block number we ran it will also be right so keeps keeps adding like it will also be um okay i'm just gonna be super risky uh okay so because it's gonna be such an int map right so it's going to be like yeah so i'm going to every let's say every hundred blocks we have the end condition here and now simulate block f l b l a name a case a num block okay so we just okay collision floor similarly max block floor prime new block inps so this floor floor right floor prime um also is the base of that so it's always okay so if a num if a num thousand then where f l prime equals so we're gonna do the unions with um so we're gonna prune it in the following way we are going to a restrict can we we don't have the in three a we're gonna get them because a in the for for map there's a restrict like a restrict he said right okay so what we're gonna do is we're gonna say a f l prime so we're gonna say i am dot to ask list of f l prime we're gonna say take we're gonna take a thousand of these we're gonna map x and then we're gonna just map to this and no this is gonna be y and minus one thousand and they're gonna take one thousand of this and then we're gonna say i am dot from ask from a distinct ask list just to keep manageable okay i am to ask list no let's not map the num block okay no it's oh no yeah it's not gonna be that much better okay i may cancel this a let's just do it the old good old way okay i'm gonna just keep this running for a few minutes i'm gonna pop off i'll be right back i'll let you watch the uh graphics okay but what we probably have to do here is we have to identify a cycle right ding ding ding ding ding let me check that actually um let me see um let me write a function that says new floor takes a floor and returns maybe in okay new floor is equal to um i am dot as ox okay uh i am dot as ox there's gonna be an inset so this is is not a from list from list a 0 to 6 floor is equal to is not from list 0 to 6 a okay let's see here now let me see a list of inset uh so it's gonna be a filter a equals floor dot snd let's check okay a level prime equals so if new floor if and then new floor fl prime if now new floor fl prime then a fl prime if and else new floor fl i'll show the new floor and i'll also show the no i'm gonna drop that first floor ah so level 58 becomes a new floor and then i can just offset that right okay so let's have a new number here offset okay so let me check here we have here a fl prime maybe int int drop one list to maybe import data dot maybe uh list to maybe okay so we have the fl prime okay and then offset prime okay then we just set a a nfs equals a new floor fl prime so floor prime is gonna be a a offset is equal to ks nfs of just i a offset prime ks nfs offset plus i okay and now i'm gonna call this with the max block non block offset prime a and this is also gonna be offset prime and this is actually gonna be offset plus a first of find im dot find max offset prime offset prime so and then the floor a so nfs so if there's a case nfs of just i okay and then um i'm going to say so the floor is going to be a take a i plus one i'll take from the im dot from s list of uh fl prime and i'm going to map over it okay i'm gonna say map a key comma v key key minus i comma v okay and i'm gonna say im dot from s list or distinct just fl prime okay and what is the problem here simulate have different amount of arguments max block non block offset floor uh offset yeah this one was just one there okay all right then hint let me just rewrite this as simulate prime actually a didi didi didi simulate prime simulate prime a offset prime bl shaded blah blah blah blah okay and uh simulate takes in a max block a initial equals a simulate so non block is zero offset is zero floor is initial floor and a block is going to be a new block zero zero this is going to be initial init yell simulate prime and simulate prime doesn't work because okay where indent all this damn all this stuff a twice okay where okay so simulate prime it's okay and simulate prime we have this other where here okay and now we're actually we're not gonna have the max block here that's just already there now we don't need to pass it indent doesn't actually change sure these are all correct okay and then down one is also here and the block is also there and the sprint is also there okay take advantage of my key some okay so this is max block initial offset okay floor the initial floor block and initial input simulate prime takes an int and an int and an int and a floor and a block and a seek input and input and returns an int and get back to you guys i've had too many arguments okay non block a uh offset initial floor this is gonna be too asking sorry i don't get what's wrong here so there's uh one argument there's a okay sorry there's one argument non block and then let's see offset and then there's initial floor and then there's a new block and then there's the initial input right and then this one is actually just like this okay and then this one is actually just simulate 2022 and this is just simulate billion and age a good that it's actually exists in the example but let me wait for it to run in task two amity map has no maximal element let me see here brace show id okay now it's super slow the input what does one okay new floor okay so the new floor becomes a we find a new floor then i'll get mixed up is a trace show the offset and i a new block ah it never gets evaluated that's a loop okay so offset prime we never get the value okay yes gonna do two okay um okay seems to run too high okay let's see actually um sprint task one actually let's print a simulate 59 it's gonna be a first simulate 22 and i want to see here a offset plus a total equals offset plus i don't find max a lower okay so first of this first of this and use is gonna be total comma total comma trip trip trip trip trip okay what's the one that happened after 20 blocks okay after 35 blocks um 3123456 there are seven blocks okay so the first one is the floor okay and ah let's do here a i comma FL and CMU 36 okay? CMU 36 over brain to FL. Render, lower FL. Okay, those like this. Our next recalls and probably probably blocks here. Now, that's just a bail on this. Let's see. It's just FL prime. Let me simulate 36. I just want to see what happens. Yeah, so there's a new floor. Okay, okay. And this one was, so if we printed it, now let's print this. Okay, so zero and then 58 from list. Okay, then I'm gonna say, okay, so what I'm gonna do here is I'm gonna, I'm not gonna, the new floor is actually, we're gonna drop. Okay, so we're gonna say to to ask list, ask list, then we're gonna drop, we're gonna drop i minus one, drop i minus one. And then we're gonna, this is how, this is the way. Okay, okay, so drop and drop high and the coordinates are correct. And the offset is 58. So let's simulate 22 here. Print i. But it returns a number that's too big. Right? What was our answer for number one? B166. Okay, so there's something wrong with our answer still. Okay, yeah, I don't want to print out the example. Okay, then it just grows and grows and grows. Okay, so there was a floor from this thing. Ah, not reverse this. Just with it. What is this other trace show here? Why am I getting like multiples? 58. So this is like 106. So just for some, then 153. Let me see here.  I don't, I don't understand why it's being added so many times. What's anything happening? Nothing happening. So case NFS of new floor FL prime offset plus i comma f prime. I only want to do this if there's an offset. Okay, 3166. And that was the solution that was possible. Okay, good. The thing was that even if I wasn't updating the floor, I was updating the offset. Okay, good. Now it's not running every time. I run this for one million times. How long is that thing? Seconds. Okay, let me see. This integer, this offset is probably an integer. Integre. Integre, first offset plus from integral. Integre. Integre. Integre. Integre. Integre. Integre. Integre. Integre. So to do a million takes, and then we're doing a million million. Let me print out these offsets. Probably a way to short-circuit it, right? Like you won't reach a loop at some point. No, trace show. But of course it won't be the offset that's here. It will be the eye. Yes, there's a loop. So we just figure out the loop and then we can short-circuit it. How do we check that? So what is the loop condition? So is loop takes in the block, so the block mod, right? The offset keeps changing. It takes in and the current new floor, right? And it takes in the imp, like the current state of the imp. And it takes in case a block mod comma floor floor floor comma imp, set dot member seen, import, qualified, data dot set, as set, import, data dot set, set. Okay, so is loop seen block mod for input? Okay, add here and set dot empty. Okay, and now we'll do here a, we'll do simulate. But then I need to like run it from the I need to run it from like that. So I need to find where it loops. And then I'm going to like the modulus of the loop. And then I need to, okay, so, and then we'll say here, compressed. And I'll add that here. True. Okay. Okay, otherwise, okay, so this is when we, well, okay, and then I'm going to say if compressed and is loop seen here, I'm going to have seen here. Okay, and this is going to be set. It's going to be a int. It's going to be a, well, int. It's going to be a floor. And it's going to be seek. And it's going to take a long time to actually check if the second business could be not, we would be nice if we had like a integer like current offset into the thing. Yeah, we don't have that. Okay, a scene, if compressed and is loop seen actually, I can actually write block here. So if I've seen is loop, I can just do it directly. A block, a floor, and set.member scene, then error, loop found, loop found, and scene, okay, loop found, plus plus plus show and simulate. And we do a set.insert. And we insert into this set, we insert the new block, we insert the lower and we insert the imps prime, if compressed and new block for imps prime seek input. I only do this when I, when I actually a no instance for or input, okay, and I'll just derive you. So there's a loop after 2,919 blocks, okay, and okay, then we'll do found to 19. Okay, that's it, write some more stuff here. Plus plus show, okay, and we'll do a mods show, plus plus show. So I'm going to do a now I'm going to do business for the this is from one million. I'm going to do a max lock mod num block. This is how many times we would repeat it. Actually, it's going to be we're going to divide. So 342 times, but this is not for the billion. Okay, so let's say, let's just see what it gives for a million. And then let's test it, right? We're not going to trace show anymore. That took 10 seconds, right? So 1577186. Okay, so we'll write that here should give 15, no, no, should give. Okay. So instead of, so now we're not going to error, but we just compressed. Okay, so then we loop found a block offset. Okay, so max block div num block. Okay, so mods. So this is going to be a mod num block, plus plus a show max block div num. Okay, mods divs. Okay. So what I want to do now is I want to do to do to do to do. I want to do so instead of let's not do an error. So what we're going to do is we're going to say a simulate prime. So we're just going to jump to the end of the loop, right? We're going to say num block times a, okay, let's say let divs equals a max block div num block in Okay, now we're going to say here simulate prime things. That's not going to change, but num block times divs. Num block times divs. Okay, and then offset prime times divs as well. Lower prime, new block, imps prime. Okay, it's a little off. In fact, I think it's, let's print all these things. Okay, so we're going to show, so let's see show num block times divs. Okay, so I want to see what this is. So this should be like a million. This is a million minus 1700 and right now I'm going to see a go from integral. And I think I want to just see the offset first and then I'm going to see the this is the current offset prime. Okay, what if I do a loop, loop found. Ah, no, this one should be loop floor prime. Sorry about that. Okay, set for new block for prime and primes have never seen. Yeah, I should add floor prime here. Yes, okay, and then there's not a, it's not returning the right one. 157, 7186, 157, 7186, but almost, right? It's almost there. And maybe I have to write. Okay, yes, so we started from the scratch again. Ding, ding, ding, ding. Ding, ding. Is it like this? No, I'm having crazy dejavu here for some reason.  Ding, ding, ding, ding, ding, and I need to do plus one here, right? I didn't need to, but this will still not the right one. We're pushing five hours now. Let me see, is my camera still working? Yeah, still going strong. Amazing. And then it's hitting the max, and then maybe the offset calculator is wrong. Okay, well, okay, let me take a quick break a little bit. We're almost there, let's see. So I think it's okay. Let's actually not, okay, times James plus one. What's happening is that it's not, it feels like it's not a, let me see, okay, in error, root bound. Okay. So the, let's show here a, show a offset prime, we're going to show a number of the block, and we're going to show James. Okay, so every 2,281 blocks, we loop, okay, so and every 2,201 blocks, the offset gets increased by, what if we just do, let's see, a, cont equals, just like the continue command. Now we've seen a, ns, a, okay, let's see here, cont, and with this new scene here, so here we'll just do, create, show, offset prime, and insert, set dot single, then, let's see what this outputs, 3,572 times 2, 6,340, 9108 minus 2768, 1186, 11876, minus 11876, 11876, minus 9108, so it might do something in the beginning, and then start looping, okay, and so it does something in the beginning, and then it loops, starts looping, so we have to, so we have to identify the length of the loop, okay, so the first time we see it, okay, then we'll do it like this, okay, so we'll, okay, so let's do like this, because the loop might not be like from the initial condition, it will be from some looping condition, okay, so I want to see now, okay, so it starts off, right, so we've seen it before, so I mean we might do the compression a couple of times, but then it starts looping, okay, if compressed, and then, and seen, okay, then we'll have the, you know, we'll have the curve offset equals, let's just return the offset here, offset, okay, and the current offset is, the current offset is offset prime, now I want to, I'm gonna run this the same as seen, non-block offset floor down one imps prime, okay, so the length of the loop, let's put here another bool, bool, bool, this is break on loop, break on loop, okay, so if compressed and new block, then if bool, so then this flag is true, and then, so now we're running it in like the fbol, and then we're gonna run return, it's gonna be either, and then something, and there are something else, and then it's gonna be from right, okay, either, so if we're gonna break on the loop, we're gonna return the, we're gonna return the block number, right, the bool set, we're gonna return the block number, we're gonna turn the offset, it does an every loop, okay, so it's like this, so if bool, then we're gonna just return new block offset, and we're gonna do left, else, so this is just the right, and then this is from import data.either, or data.either, from right, why doesn't it want to can match type, and now it is from right, but we want to not break on loop, no, and cannot match integral floor, it's either enter into integral floor, or from right, the bool set integer initial floor block, usually put, this is supposed to be not new block, but num, something's not matching here, a's of, right, a2, and then the type of this a is gonna be a error, oh no, okay, so if break on loop, then we return this, else, else, okay, else we do a, a, let a loop res equals a simulate prime, set a true break on loop, set.empty, and we're gonna, so we're gonna start it off again, with this new, but with this same thing, in there, a's in, a is seen equals, set that single, and then this whole thing, okay, loop res, a simulate true, a is seen, and I want to start it off at, and one block zero, because I don't want to stop it there, I want to stop it at offset is zero, floor prime, new block, int prime, and this is gonna be an in error, and show loop res, else that we did not comprise, can't, and where can't is, let me see, we'll run it, we run it to the loop, and this is the loop, this is the loop, the length of the loop, so until we see the same thing again, okay, so I want to do a, let me see, loop res, so let's see here, until loop equals a, so this is a left, lbs, a los, num, and this is gonna be until loop, this is gonna be a num block minus lbs, let's show here lbs, so how many do we get until we, oh, sorry, until loop, okay, so I have the until loop, right, so I have the num block, and so I want to do here, this is the loop size, okay, now we're gonna do max block, divs equals max block, div a loop size, loop size, there's equals loop size, so let's write divs here, until loop equals num block minus lbs, minus loop size, show until loop divs, okay, so it's five already, and then 571 times the loop, okay, so we will now do here, we will do right, it's gonna be final res, so we're gonna run it again, but we're not gonna run it until full, so final res a final blur equals, and now we're gonna simulate prime, set.empty, simulate, and now we're gonna say false, we're not gonna break on loop, but actually, yeah, this will be fine, this can be whatever, true, set empty, and then we're gonna say a zero, zero, floor, prime, new, block, imps, prime, but here we're gonna have a divs times, okay, so we're gonna have the um, until loop plus a divs times loop size, okay, let's print here a final res, hit the loop again, did you not hit the loop again? okay, divs times loop size, okay, maybe this has to be a num block, why does it hit the loop again? it seems like it's hitting the loop even earlier, what is it saying here? because it's, yeah, okay, so uh, trace show id, so set.empty, and I don't want to start it off at a num block, because it will become larger than equal to max block, so let's see here, um, divs times loop, this is like a 500, okay, so let's see here a max block minus, this is gonna be the mods, mods equals a, let's see, until loop, and then, okay, so we know how long the loop is, loop offset incurved, blink, blink, blink, boom, boom, boom, boom, boom, boom, boom, boom, boom, boom, okay, so it's gonna, so what is that current block, so until block, okay, until loop, and then num block, okay, so we're at the block number 2281, so I think it's actually a max block loop size, this is actually divs, so we're gonna take max block minus until loop, okay, so this is how many times a loop will run, and now mods will be the same, max block minus until loop, this will be like the how many times it will run in the last one, it will run for 1400 in the last one, okay, so let me put this on a right trace, shift drop empty, and let's put this on max block minus mods, okay, and then it has a, so then we'll see the final raise, and I don't want to draw the threshold ID there, okay, so then let me print out even more stuff, okay, so offset, and a loop offset incur, so before, before equals offset minus of looped offset incur, a, let me see, loop offset incur, loop offset incur, okay, the final offset, okay, let's do here a final floor y max equals first of im.findmax final floor, now, okay, so let's see, so it's offset before plus divs times loop offset incur plus final raise plus final floor y max, okay, from integral, from integral, divs doesn't like it because, ah, from integral times from integral divs, okay, no, yes, so this is 10856594, this is a lot, this is too much, so offset before, wait, so offset, loop offset integral, let me run divs loops, okay, then final raise is this, no, this is not at all enough, okay, let me see, no, offset before, okay, then a loop offset increment, and then final raise, and then a final plus final floor y max, okay, so the offset before, so every time you run the loop, it wrote, it increases the offset by 1901, now divs, so this is how many times we run the loop, let's print out a divs times loop offset increment, let me check again one thing, okay, so the offset before, okay, so they have the, what is the offset here, okay, so per loop, it runs in, this should not be set to NP, well, ah, maybe offset before is a, let's see, what is the loop size, loop, nice, 2389, and then you get a loop, until loop, until loop is minus 108, that's not okay, and no, this has to be ISC, okay, so I take it and then run the whole thing, and when I see the thing, when I see the beginning of the loop again, I know how many blocks it took, and I know the offset from zero that each loop increments, ah, plus a from integral dollar, find, and then this is a loop offset increment, okay, no, this has to be asset prime, okay, so I started from zero, and then I went up to this, so this is loop, okay, so until loop is 539, loop offset increment, okay, and what is a offset prime, oh yeah, okay, so that's the thing that I'm screwing up here, a offset, this is offset before, it's offset prime, offset before, okay, so it's 833, and then 2759 per loop, and then, okay, now we're getting pretty close to that number, what was it, 157186, 157, 7186, okay, so I want to say here, okay, so we do a offset before, offset before, before, plus loop contribe equal divs times loop offset increment, and from integral, offset before, plus loop contribe, plus offset before, offset before, 157, 5654, okay, that's too much, what about offset prime here, plus loop contribe, and then we don't find the Y-max, okay, offset and ring, I want to do so the offset before is 830, and all loops, and then, okay, so then we run all those loops, and then we add the final res, FAAE, final after loop equals final res, plus from integral, integral, final for Y-max, okay, let's see, okay, so offset before, okay, and then this is the per loops, and then this is the final res, final after loop, after loop, okay, so from loops equals this, right, as before from loops, I would like to say that it's offset before, plus from loop, plus final after loop, but that's missing, okay, missing, what if I do plus loop, is there one loop missing, plus loop offset incur, minus, what if I adjust the short circuit here, okay, let's see what's here, and so let's see, until loop, plus a divs times loop size, okay, and then they, let me run it, okay, this is the one, 103, what if I just do emulate prime, do I don't do it like this, I do set dot empty, and I have this as the offset here is, maybe it's not offset before, maybe it's offset, 5, 7, 7, 600, 7, 7, 5, 5, 5, probably also prime, loop offset increment, so I want to see what this is, a, I am dollar, FST, I am that prime max, FLM, minus a, oops, divs times FLM, I mean we're very close, okay, so one loop, this is the loop size, maybe this is actually non-block, plus one, let's see how that changes things, plus FST 525, 1, 5, 7, 8, 1, 1, 8, 6, minus minus a from integral divs, there's a lot of guesswork involved today, very close, like I said, the new block is in there, there was a collision, lower down one, okay, then the next, the loop size is, let's see this offset prime is there, okay, now that was definitely off, yeah, this is definitely the offset prime, okay, now the loop size is this, right, loop offset increment FLM, and the idea there is, yeah, if I start at these conditions with zero and zero, I'll go for non-block, plus one, and it increases my offset loop offset incur, and this is an integer, and this is an int, so every time I run the loop, it increases by this, I detected a loop, okay, so I do offset prime, okay, so I do offset prime, okay, which is like the current value, right, offset prime, and then offset prime times my plus, I do a loop offset incur times divs minus one, right, from integral, and it doesn't like this, okay, so this is after I run the loops again, again, again, and then I have the final after loop, plus a final after loop, and okay, I'm missing, I'm missing 1577525, okay, so there's something wrong, now you see ops before, let's just see a div, let's just see this, a v equals, this is a 15, so this is v minus 15777186, the difference there is a offset prime now, ops before the loop, let me see, this is zero block, zero block, okay offset, lower, let's just turn this off and see what is it supposed to say, again, but let's do it like for a different number of calls, let's simulate the not for a million, but for something like 100, 157586, 1576922, okay, I feel like I've seen this number somewhere, let me see, okay, so let's not turn this off, okay, print y and then print a, okay, so this is also a trick, right, so what is the final reds, let's see here, error show, I am, I am not finding the max final, ah, okay, so the final four is not correct, interesting, okay, that's important, right, so that's, so this should be, until loops, a divs times loop size, until plus divs times loop size, same non-block, the count here is, this should be the one that we want, okay, but there's the true side out here, okay, so, I mean this should for sure give the same as that, right, let's do this for a smaller number, ding ding ding, short, short and compressed, let's see here, true, okay, so the final four there seems to be 94, 456, this is my prime true, break on loop, okay, it doesn't break on the loop because it doesn't hit the loop, let's just um, this be, it doesn't actually use that right, yeah, okay, this can just be true, we have to start on the floor, what about do, uh, BL, okay, I seem to be not even getting the final, the final floor down, okay, so what I want to do is, it's not even close, right, ding ding ding, okay, this is non-block, so this is the loop, okay, this should be new buck plus one, right, no, this is a new buck, and then this is the max, okay, what is the FLM here, okay, so the claim is that the loop size is 1752, okay, so if I do here, let's see, floor prime, new block, 94, okay, and we get the FLM out of that, it's 1752, then if I do max block minus loop size, I should get the same black, right, I am dot find max, final floor, okay, and then you see, this should be M dot find max, I am dot find max, it's not even, it doesn't seem to be looping like that, okay, so max block minus loop size minus one, the loop is this, it should be, okay, let me see, okay, and then it does run for loop size blocks, right, and with this floor prime, a new block, and I'm claiming that I've seen this before, but it's not giving me, it's not giving me the same, so this loop detection is off somehow, let me see, let's change the scene to be a map to import data dot map map, import qualified data dot map as map, okay, so map dot member scene, and then when we insert into it, map dot insert, map dot insert is, and then scene, or is it key, scene, and then key, and then a new block plus one plus one, okay, and then just a map dot single 10, zero, map dot empty, and simulate press, hit dot empty, map dot empty, okay, let me see, and we don't need to run and get this loop size, we just need to look up what it was, what was the block number, last time we saw this, let's put this, yeah, okay, this is the call, so now block plus one base scene, okay, now let's do a, a, a, okay, equals, let's print the look up here, let's print, not to look up, let's print map, okay, scene, map dot bang, okay, up, just like to seven, and now let's see until loop, now let's see what the current block number is, none block plus one, okay, so the loop size, I'm not gonna, I'm not gonna do this again, okay, I don't need to run it again, I just need to check, so yes, prev scene equals map dot bang, okay, up scene, loop size is equal to num block, also the current block plus one, minus prev scene, maybe I should add the current map answer, so the num block and the offset prime, if I actually just int comma integer comma floor, okay, and then this one is going to get this break on loop, notice break on loop crop, this is prev scene, prev scene and a psf and a ps0, okay, so all the size, num block plus one, minus, now divs, plus one, minus a, the scene, right, for show prev scene, we simulate ns, we simulate, okay, let me show check, so I want to see, let f os, f final floor is equal to simulate prime, but I'm deep, now I want to see that if we go from 0, the offset, so final 0 here, floor prime, imps prime, simulate prime 0, and num block is also 0, floor prime, a new block, imps prime, imps, okay, right, so I want to see here, max block minus loop size, final offset, max ff, okay, I seem to have this, I'm up by one somewhere, okay, so this block was previously seen at 527, and I am prime max ff and I am the prime max floor, so this should be the same, right, but they are not, there is something weird going on here, it's like it loops, so after, so I was at block, so 527, and then I ran it, maybe we should insert a new block this is a, okay, up, we'll insert the lookup, and then let's use that, this is num block was one, what if I run it two times, do I get the same 5,56, should be like that, right, ah, no then it's, okay, let's simplify this all, unless you say here, case, okay, up equals BL, floor, orig, let's just check out that, BL, so okay, up equals BL, floor, orig, okay, so if we've seen this exact thing before, case, okay, up, map.member, scene equals error, just r, comma, whatever, is going to be error, dollar, show, our, scene, okay, that NS equals if compressed, I only insert when I compress, and then I'm going to just print it, okay, and okay, I just compressed, and insert the, not the offset prime, but the offset, and the floor, okay, now this has show r, num block, this is when we've seen it before, okay, now I'm going to do that loop, so loop size is equal to num block minus r, okay, and then I'm going to say a osfl is equal to a stimulate prime, max block minus loop size, and now it's definitely going to be, so map.empty, so we don't want to be looking up again, map.empty, max block loop size a zero, floor, BL, orig, okay, but then it does loop, os, orig, fl, let's find max of floor, it should be the same, for sure, yes, okay, but the current, the r and the num block are different, right, so now I'm 1755 block later, and I'm seeing the exact same, okay, but what is the current offset, offset, and orig, offset, orig os, okay, so os per loop is equal to offset minus orig, offset, let's see, and this is an offset prime, no, no, no, crap, os per loop, okay, first scene, this is going to be first scene, so how many loops are there left, each loop is 1755, okay, so block minus first scene, and divs equals max block minus first scene, divs, loop size, divs, how many, how many loops are there, oh no, show r, okay, so this is the first scene, and then os per loop, so divs, so I want to say that what is a divs times loop size 98208, okay, and then I want to say first scene, okay, so now I want to say left equals this, right, first max block minus first scene plus divs times loop size, okay, so outstanding, I want to do here then a map.max block minus outstanding, and with a floor on the peel on the orig, outstanding, fl, okay, and I'm short here also, so that it doesn't do it when it, we don't want it to, so okay, so outstanding, so I want to see now a orig os plus a divs times os per loop, plus os outstanding, huh, and that is exactly correct, wow, finally, okay, so I will do, I'll return this, two three, one two three, now a final, yeah, so I was just playing off by like some, you know, loop prime, blah blah blah blah blah, now final, this one has to be an integer scope, dollar, first dollar im dot find max, new block, you see if this is correct, well let's run on the example first maybe, maybe it took a lot longer for the example to loop, right, let's just take it out, push, seven hours, how much time did we spend infusing ourselves by some, you know, we ended up just kind of, ah, just just do it, you know, just do it in the end, and the code is not that difficult in the end, right, but seven hours, wow, well, thank you for those who stuck around the whole night, anyway, get status, get add day 17, oh, get add day 17, get status, get commit, am date 17, get push, ah, but we did do it in a very short time, right, paid too many seconds, but yeah, okay, that's it, thank you for tuning in, you had a fun time, and well, tune in later, if you like, all right, thanks a lot, and goodbye.


Welcome folks, we had the Dow industrials finish up 38, Nasdaq up 46, S&Ps up 9.5, Gold contract flat 12.94oz, we had silver up 3 cents, $15.09 an oz, LightSuite crude down 11 cents, $62.47 a barrel, oil focus is impressive, what you had out here with the oil market, you had a huge build, bottom line is that they couldn't get it to a lower price, so oil still is trying to charge into this $65 level. Notes and bonds, 10-year note down 9 ticks, $123.15, 30-year off $28, $147.14, now they both came down with lighter volume, they didn't hold price, bottom line is that they're coming into this strength with tremendously lighter volume, the 10-year, we take a look at this 10-year, when I say don't hold price, didn't hold price, let me just show you what I'm talking about here, what I would like to see, my take is it was still going high, but what I would like to see out here today is that we got above, state, well state above the $123.16, or one tick underneath it. That's how we come down on Monday, we come down pretty high, well we do come down hard on Monday, you come down, you had 1.7 million contracts, now you're going into 2.5, but today you had 1.4, so it would have really been sweet if we could get a rejection of lower price, which we did not get out here today, so that puts game on for $123.10, $123.10 inside that 10-year, and we're going to take a look at King Dollar, you know King Dollar yesterday went up, tried to test its March 7th highs, didn't make it all the way up, the March 7th high is $97.160, we made it to $97.09, that being said, volume was contracting in a huge way, what do we do today, guess what, you back down light volume, we've only done 12,000 contracts, you're going to leave out more contract volume to stay down in the dollar index, what we did do is that you did get back underneath the February 15th level, which says quite a bit, bottom line, we'll see where this baby shakes out. Stay right there folks, you've got a few numbers coming out after the close, Dow finished up 38, Nasdaq up 46, SAP is up 9, come right back.