Keep a shared start as empty text. Place "RXXLRXRXL" into start. Keep a shared finish as empty text. Place "XRLXXRRLX" into finish. Keep a shared first of 0. Keep a shared second of 0. Keep a shared startlast of 0. Keep a shared finishlast of 0. Keep a shared verdict of 0. Keep a shared leftmove of 0. Set startlast to 8. Set finishlast to 8. Set verdict to 1.
To skipstart from spot (a whole number). If spot is more than startlast, set first to spot, return. The piece is the slice of start from spot to spot plus 1. If piece matches "X", skipstart from spot plus 1, return. Set first to spot.
To skipfinish from spot (a whole number). If spot is more than finishlast, set second to spot, return. The piece is the slice of finish from spot to spot plus 1. If piece matches "X", skipfinish from spot plus 1, return. Set second to spot.
To compare from left (a whole number) with right (a whole number). Set first to left. Skipstart from left. Set second to right. Skipfinish from right. If first is more than startlast and second is more than finishlast, return. If first is more than startlast or second is more than finishlast, set verdict to 0, return. The leftspot is first, while the rightspot is second. The one is the slice of start from leftspot to leftspot plus 1. The two is the slice of finish from rightspot to rightspot plus 1. If one does not match two, set verdict to 0, return. Set leftmove to 0. The rightmove is 0. If one matches "L", set leftmove to 1. If one matches "R", set rightmove to 1. If leftmove is 1 and second is more than first, set verdict to 0, return. If rightmove is 1 and second is less than first, set verdict to 0, return. Compare from first plus 1 with second plus 1.
Compare from 0 with 0. If verdict is 1, show true, otherwise show false.
The heights is a list of 0, 2, 1, and 3, while the side is 2. The seen is a list of 4 zeros, while the spare is an empty list of whole numbers. The queue is an empty list of whole numbers. The answer is -1, while the found is 0.
For every level from 0 to 3.
Set queue to spare. The head is 0, while the count is 0. If item 0 of heights is at most level, set item 0 of seen to level plus 1, Place 0 into queue, add 1 to count.
Repeat while head is less than count and found is 0.
The node is item head of queue. Add 1 to head. The row is node divided by side, while the column is node modulo side. If row is more than 0 and item (node minus side) of heights is at most level and item (node minus side) of seen is not level plus 1, set item (node minus side) of seen to level plus 1, Place (node minus side) into queue, add 1 to count. If row is less than 1 and item (node plus side) of heights is at most level and item (node plus side) of seen is not level plus 1, set item (node plus side) of seen to level plus 1, Place (node plus side) into queue, add 1 to count. If column is more than 0 and item (node minus 1) of heights is at most level and item (node minus 1) of seen is not level plus 1, set item (node minus 1) of seen to level plus 1, Place (node minus 1) into queue, add 1 to count. If column is less than 1 and item (node plus 1) of heights is at most level and item (node plus 1) of seen is not level plus 1, set item (node plus 1) of seen to level plus 1, Place (node plus 1) into queue, add 1 to count. If item 3 of seen is level plus 1, set answer to level, set found to 1.
Show answer.
Keep a shared symbol of 0.
To expand from rows (a whole number) with place (a whole number). If rows is 1, set symbol to 0, return. If place modulo 2 is 1, expand from rows minus 1 with (place plus 1) divided by 2. If place modulo 2 is 0, expand from rows minus 1 with place divided by 2, set symbol to 1 minus symbol.
Expand from 4 with 5. Show symbol.
The startx is 1, while the starty is 1. The targetx is 3, while the targety is 5. The reachable is 0.
Repeat while targetx is more than startx and targety is more than starty.
If targetx is more than targety, set targetx to targetx modulo targety, otherwise set targety to targety modulo targetx.
If targetx is startx and targety is at least starty.
The gap is targety minus starty. If gap modulo startx is 0, set reachable to 1.
If targety is starty and targetx is at least startx.
The gap is targetx minus startx. If gap modulo starty is 0, set reachable to 1.
If reachable is 1, show true, otherwise show false.
The answers is a list of 1, 1, and 2, while the limit is 1000. The counts is a list of 1001 zeros.
For each answer in answers.
Increase item answer of counts by 1.
The total is 0.
For every spoken from 0 to limit.
If item spoken of counts is more than 0.
The group is spoken plus 1. The groups is (item spoken of counts plus spoken) divided by group. Add groups times group to total.
Show total.
The board is a list of 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, and 1. The side is 4. The valid is 0, while the mixed is 0. Set valid to 1.
For every row from 0 to 3.
For every column from 0 to 3.
Set mixed to exclusive or of item 0 of board and item (row times side) of board. Set mixed to exclusive or of mixed and item column of board. Set mixed to exclusive or of mixed and item (row times side plus column) of board. If mixed is 1, set valid to 0.
The rowsum is 0, while the colsum is 0. The rowswap is 0, while the colswap is 0.
For every spot from 0 to 3.
Increase rowsum by item spot of board. Increase colsum by item (spot times side) of board. The rowparity is spot modulo 2. If item (spot times side) of board is rowparity, add 1 to rowswap. If item spot of board is rowparity, add 1 to colswap.
The half is side divided by 2, while the otherhalf is (side plus 1) divided by 2. If rowsum is not half and rowsum is not otherhalf, set valid to 0. If colsum is not half and colsum is not otherhalf, set valid to 0. If rowswap is more than side minus rowswap, set rowswap to side minus rowswap. If colswap is more than side minus colswap, set colswap to side minus colswap. The answer is (rowswap plus colswap) divided by 2. If valid is 0, set answer to -1.
Show answer.
Keep a shared values holding 4, 2, 6, 1, and 3. Keep a shared lefts holding 1, 3, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, and -1. Keep a shared previous of -1. Keep a shared best of 1000000.
To gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. The here is item node of values. If previous is at least 0 and here minus previous is less than best, set best to here minus previous. Set previous to here. Gather from item node of rights.
Gather from 0. Show best.
Keep a shared lowers as empty text. Place "abcdefghijklmnopqrstuvwxyz" into lowers. Keep a shared uppers as empty text. Place "ABCDEFGHIJKLMNOPQRSTUVWXYZ" into uppers. Keep a shared word as empty text. Place "a1b2" into word. Keep a shared current as empty text. Keep a shared answers as an empty list of text. Keep a shared piece as empty text. Keep a shared found of 0. Keep a shared letterindex of 0.
To seek from spot (a whole number). If spot is more than 25, return. The lowpiece is the slice of lowers from spot to spot plus 1. If lowpiece matches piece, set found to 1, set letterindex to spot, return. The uppiece is the slice of uppers from spot to spot plus 1. If uppiece matches piece, set found to 1, set letterindex to spot, return. Seek from spot plus 1.
To build from spot (a whole number). If spot is 4, The copy is a copy of current, Place copy into answers, then return. The symbol is the slice of word from spot to spot plus 1. Set piece to symbol. Set found to 0. Seek from 0. The here is found. The holdindex is letterindex. If here is 0, Place symbol into current, build from spot plus 1, remove last character from current. If here is 1, The little is the slice of lowers from holdindex to holdindex plus 1, Place little into current, build from spot plus 1, remove last character from current. If here is 1, The big is the slice of uppers from holdindex to holdindex plus 1, Place big into current, build from spot plus 1, remove last character from current.
Build from 0. For each answer in answers, show answer.
Keep a shared edges holding 1, 2, 3, 0, 2, 0, 1, 3, 0, and 2. Keep a shared starts holding 0, 3, 5, and 8. Keep a shared counts holding 3, 2, 3, and 2. Keep a shared colors as an empty list of whole numbers.
For every spot from 0 to 3.
Place 0 into colors.
Keep a shared spare as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. The valid is 0, while the found is 0. Set valid to 1.
For every source from 0 to 3.
Set queue to spare. The head is 0, while the count is 0. If item source of colors is 0, set item source of colors to 1, Place source into queue, add 1 to count.
Repeat while head is less than count and valid is 1.
The node is item head of queue. Add 1 to head.
For every offset from 0 to item node of counts minus 1.
The target is item (item node of starts plus offset) of edges. If item target of colors is 0, set item target of colors to 3 minus item node of colors, Place target into queue, add 1 to count. If item target of colors is item node of colors, set valid to 0.
If valid is 1, show true, otherwise show false.
The numbers is a list of 1, 2, 3, and 5, while the rank is 3. The numerators is an empty list of whole numbers. The denominators is an empty list of whole numbers.
For every left from 0 to 3.
For every right from left plus 1 to 3.
Place item left of numbers into numerators. Place item right of numbers into denominators.
The count is the number of items in numerators. The final is count minus 1.
For every pass from 0 to final.
For every spot from 0 to count minus 2.
The next is spot plus 1. The lowproduct is item spot of numerators times item next of denominators. The highproduct is item next of numerators times item spot of denominators. If lowproduct is more than highproduct, swap item spot of numerators and item next of numerators, swap item spot of denominators and item next of denominators.
The chosen is rank minus 1. Show item chosen of numerators. Show item chosen of denominators.
Keep a shared distance holding 0, 1000000, 1000000, and 1000000. Keep a shared next as an empty list of whole numbers. Keep a shared spare as an empty list of whole numbers. The origins is a list of 0, 1, 2, 1, and 2, while the targets is a list of 1, 2, 0, 3, and 3. The fares is a list of 100, 100, 100, 600, and 200. The stops is 1, while the answer is 1000000.
To carry from node (a whole number). If node is more than 3, return. Place item node of distance into next. Carry from node plus 1.
For every round from 1 to stops plus 1.
Set next to spare. Carry from 0.
For every flight from 0 to 4.
The origin is item flight of origins, while the target is item flight of targets. The fare is item flight of fares. The candidate is item origin of distance plus fare. If candidate is less than item target of next, set item target of next to candidate. If flight is 4, set distance to next.
Set answer to item 3 of distance. If answer is at least 1000000, set answer to -1. Show answer.
The limit is 10. The count is 0.
For every number from 1 to limit.
The value is number. The good is 0, while the turned is 0. Set good to 1.
Repeat while value is more than 0.
The digit is value modulo 10. If digit is 3 or digit is 4 or digit is 7, set good to 0. If digit is 2 or digit is 5 or digit is 6 or digit is 9, set turned to 1. Set value to value divided by 10. If value is 0 and good is 1 and turned is 1, add 1 to count.
Show count.
The ghosts is a list of 1, 0, 0, and 3. The targetx is 0, while the targety is 1. The pairs is 2, while the escape is 0. Set escape to 1. The mydistance is targetx plus targety.
For every ghost from 0 to pairs minus 1.
The ghostx is item (ghost times 2) of ghosts. The ghosty is item (ghost times 2 plus 1) of ghosts. The gapx is ghostx minus targetx. If gapx is less than 0, set gapx to 0 minus gapx. The gapy is ghosty minus targety. If gapy is less than 0, set gapy to 0 minus gapy. The theirdistance is gapx plus gapy. If theirdistance is at most mydistance, set escape to 0.
If escape is 1, show true, otherwise show false.
The ways is a list of 4 zeros, while the steps is 3. Set item 0 of ways to 1. Set item 1 of ways to 1. Set item 2 of ways to 2.
For every step from 3 to steps.
The value is 2 times item (step minus 1) of ways plus item (step minus 3) of ways. Set item step of ways to value modulo 1000000007.
Show item steps of ways.
The ranking is "cba", while the source is "abcd". The result is empty text.
For every rank from 0 to 2.
The wanted is the slice of ranking from rank to rank plus 1.
For every spot from 0 to 3.
The here is the slice of source from spot to spot plus 1. If wanted matches here, Place here into result.
For every spot from 0 to 3.
The here is the slice of source from spot to spot plus 1. The present is 0.
For every place from 0 to 2.
The wanted is the slice of ranking from place to place plus 1. If wanted matches here, set present to 1. If place is 2 and present is 0, Place here into result.
Show result.
The source is "abcde", while the words is a list of "a", "bb", "acd", and "ace". The lastsource is 4, while the count is 0.
For each word in words.
The lastword is the last position of word. The cursor is 0.
For every spot from 0 to lastsource.
If cursor is at most lastword and character spot of source is character cursor of word, add 1 to cursor. If spot is lastsource and cursor is more than lastword, add 1 to count.
Show count.
Keep a shared trail of 0.
To tally from value (a whole number). If value is less than 5, return. Set value to value divided by 5. Add value to trail. Tally from value.
The low is 0, while the high is 20. The aim is 3.
Repeat while low is less than high.
The middle is (low plus high) divided by 2. Set trail to 0. Tally from middle. If trail is at least aim, set high to middle, otherwise set low to middle plus 1.
Set trail to 0. Tally from low. If trail is aim, show 5, otherwise show 0.
The board is a list of "X", "O", "X", "O", " ", "O", "X", "O", and "X". The squares is a list of 9 zeros.
For every spot from 0 to 8.
The here is item spot of board. If here is "X", set item spot of squares to 1. If here is "O", set item spot of squares to 2.
The crosses is 0, while the knots is 0.
For every spot from 0 to 8.
If item spot of squares is 1, add 1 to crosses. If item spot of squares is 2, add 1 to knots.
The countok is 0, while the winx is 0. Set countok to 1. The wino is 0. If crosses is not knots and crosses is not knots plus 1, set countok to 0. If item 0 of squares is item 1 of squares and item 1 of squares is item 2 of squares and item 0 of squares is 1, set winx to 1. If item 3 of squares is item 4 of squares and item 4 of squares is item 5 of squares and item 3 of squares is 1, set winx to 1. If item 6 of squares is item 7 of squares and item 7 of squares is item 8 of squares and item 6 of squares is 1, set winx to 1. If item 0 of squares is item 3 of squares and item 3 of squares is item 6 of squares and item 0 of squares is 1, set winx to 1. If item 1 of squares is item 4 of squares and item 4 of squares is item 7 of squares and item 1 of squares is 1, set winx to 1. If item 2 of squares is item 5 of squares and item 5 of squares is item 8 of squares and item 2 of squares is 1, set winx to 1. If item 0 of squares is item 4 of squares and item 4 of squares is item 8 of squares and item 0 of squares is 1, set winx to 1. If item 2 of squares is item 4 of squares and item 4 of squares is item 6 of squares and item 2 of squares is 1, set winx to 1. If item 0 of squares is item 1 of squares and item 1 of squares is item 2 of squares and item 0 of squares is 2, set wino to 1. If item 3 of squares is item 4 of squares and item 4 of squares is item 5 of squares and item 3 of squares is 2, set wino to 1. If item 6 of squares is item 7 of squares and item 7 of squares is item 8 of squares and item 6 of squares is 2, set wino to 1. If item 0 of squares is item 3 of squares and item 3 of squares is item 6 of squares and item 0 of squares is 2, set wino to 1. If item 1 of squares is item 4 of squares and item 4 of squares is item 7 of squares and item 1 of squares is 2, set wino to 1. If item 2 of squares is item 5 of squares and item 5 of squares is item 8 of squares and item 2 of squares is 2, set wino to 1. If item 0 of squares is item 4 of squares and item 4 of squares is item 8 of squares and item 0 of squares is 2, set wino to 1. If item 2 of squares is item 4 of squares and item 4 of squares is item 6 of squares and item 2 of squares is 2, set wino to 1.
If winx is 1 and wino is 1, set countok to 0. If winx is 1 and crosses is not knots plus 1, set countok to 0. If wino is 1 and crosses is not knots, set countok to 0. If countok is 1, show true, otherwise show false.
The numbers is a list of 2, 1, 4, and 3. The low is 2, while the high is 3. The last is 3, while the count is 0.
For every start from 0 to last.
The best is 0.
For every finish from start to last.
The value is item finish of numbers. If value is more than best, set best to value. If best is at least low and best is at most high, add 1 to count.
Show count.
The word is "abcde", while the goal is "cdeab". The size is 5, while the found is 0.
For every turn from 0 to 4.
The built is empty text. The done is 0.
For every spot from 0 to 4.
The index is (spot plus turn) modulo size. Place character index of word into built. If built matches goal, set done to 1. If spot is 4 and done is 1, set found to 1.
If found is 1, show true, otherwise show false.
Keep a shared edges holding 1, 2, 3, and 3. Keep a shared starts holding 0, 2, 3, and 4. Keep a shared counts holding 2, 1, 1, and 0. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared built as empty text.
To expand from node (a whole number) with offset (a whole number). If offset is at least item node of counts, return. The target is item (item node of starts plus offset) of edges. Walk from target. Expand from node with offset plus 1.
To walk from node (a whole number). The piece is format whole number node as text. Place piece into parts. If node is 3, The built is join parts with ",", Place built into answers. If node is not 3, Expand from node with 0. Remove the last item from parts.
Walk from 0. For each answer in answers, show answer.
The numbers is a list of 2, 3, 1, 4, and 0. The size is 5. The best is 0, while the chosen is 0. Set best to -1.
For every turn from 0 to 4.
The score is 0.
For every spot from 0 to 4.
The index is (spot plus turn) modulo size. If item index of numbers is at most spot, add 1 to score. If spot is 4 and score is more than best, set best to score, set chosen to turn.
Show chosen.
The cups is a list of 6 zeros, while the poured is 2. Set item 0 of cups to 20000.
For every row from 0 to 0.
The base is (row times (row plus 1)) divided by 2. The below is ((row plus 1) times (row plus 2)) divided by 2.
For every glass from 0 to row.
The cell is base plus glass. The extra is item cell of cups minus 10000.
If extra is more than 0.
The half is extra divided by 2. The leftchild is below plus glass. The rightchild is leftchild plus 1. Increase item leftchild of cups by half. Increase item rightchild of cups by half.
The target is 2. The value is item target of cups. The whole is value divided by 10000, while the part is value modulo 10000. The rendered is format whole number whole as text. The digits is empty text. The thousand is part divided by 1000. Place format whole number thousand as text into digits. The hundred is (part divided by 100) modulo 10. Place format whole number hundred as text into digits. The ten is (part divided by 10) modulo 10. Place format whole number ten as text into digits. The one is part modulo 10. Place format whole number one as text into digits. The cut is 4.
Repeat while cut is more than 1.
The look is cut minus 1. If character look of digits is not "0", stop. Subtract 1 from cut.
The shown is the slice of digits from 0 to cut. Place "." into rendered. Place shown into rendered. If part is 0, show format whole number whole as text. If part is more than 0, show rendered.
The first is a list of 1, 3, 5, and 4. The second is a list of 1, 2, 3, and 7. The last is the last position of first. The keepnow is 0. The swapnow is 1. The newkeep is 0. The newswap is 0.
For every spot from 1 to last.
Set newkeep to 1000000. Set newswap to 1000000. The before is spot minus 1. If item before of first is less than item spot of first and item before of second is less than item spot of second and keepnow is less than newkeep, set newkeep to keepnow. If item before of first is less than item spot of first and item before of second is less than item spot of second and swapnow plus 1 is less than newswap, set newswap to swapnow plus 1. If item before of first is less than item spot of second and item before of second is less than item spot of first and swapnow is less than newkeep, set newkeep to swapnow. If item before of first is less than item spot of second and item before of second is less than item spot of first and keepnow plus 1 is less than newswap, set newswap to keepnow plus 1. Set keepnow to newkeep. Set swapnow to newswap.
If keepnow is less than swapnow, show keepnow, otherwise show swapnow.
Keep a shared offsets holding 0, 2, 4, 5, 6, 7, 7, and 7. Keep a shared neighbors holding 1, 2, 2, 3, 5, 0, and 5. Keep a shared colors as an empty list of whole numbers.
For every node from 0 to 6.
Place 0 into colors.
Keep a shared cycle of 0.
To explore from node (a whole number). If item node of colors is 2, return. If item node of colors is 3, return. If item node of colors is 1, set cycle to 1, return. Set item node of colors to 1. The begin is item node of offsets. The finish is item (node plus 1) of offsets. Explore each from begin with finish. If cycle is 0, set item node of colors to 2. If cycle is 1, set item node of colors to 3.
To explore each from place (a whole number) with finish (a whole number). If place is at least finish, return. If cycle is 1, return. Explore from item place of neighbors. Explore each from place plus 1 with finish.
For every node from 0 to 6.
Set cycle to 0. If item node of colors is 0, explore from node.
For every node from 0 to 6.
If item node of colors is 2, show node.
Keep a shared bricks holding 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, and 1. Keep a shared hits holding 0, 0, 0, 2, 0, 1, 1, 1, 2, and 0. Keep a shared reach as an empty list of whole numbers.
For every spot from 0 to 19.
Place 0 into reach.
Keep a shared results as an empty list of whole numbers. Keep a shared fallen of 0. Keep a shared columns of 0. Keep a shared final of 0. Set columns to 4. Set final to 19.
To spread from node (a whole number). If item node of reach is 1, return. If item node of bricks is 0, return. Set item node of reach to 1. The row is node divided by columns. The column is node modulo columns. If row is more than 0, spread from node minus columns. If row is less than 4, spread from node plus columns. If column is more than 0, spread from node minus 1. If column is less than 3, spread from node plus 1.
To seed from column (a whole number). If column is at least columns, return. If item column of bricks is 1, spread from column. Seed from column plus 1.
To wipe from spot (a whole number). If spot is more than final, return. Set item spot of reach to 0. Wipe from spot plus 1.
To sweep from spot (a whole number). If spot is more than final, Place fallen into results, return. If item spot of bricks is 1 and item spot of reach is 0, set item spot of bricks to 0, add 1 to fallen. Sweep from spot plus 1.
For every turn from 0 to 4.
The row is item (turn times 2) of hits. The column is item (turn times 2 plus 1) of hits. The place is row times columns plus column. Set item place of bricks to 0. Wipe from 0. Seed from 0. Set fallen to 0. Sweep from 0.
For each amount in results, show amount.
Keep a shared alphabet as empty text. Place "abcdefghijklmnopqrstuvwxyz" into alphabet. Keep a shared codes holding ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", and "--..". Keep a shared words holding "gin", "zen", "gig", and "msg". Keep a shared word as empty text. Keep a shared target as empty text. Keep a shared rendered as empty text. Keep a shared seen as an empty list of text. Keep a shared found of 0. Keep a shared duplicate of 0.
To search from spot (a whole number). If spot is more than 25, return. The piece is the slice of alphabet from spot to spot plus 1. If piece matches target, set found to spot, return. Search from spot plus 1.
To scan from spot (a whole number). If spot is more than the last position of seen, return. If item spot of seen matches rendered, set duplicate to 1, return. Scan from spot plus 1.
To finish. Set duplicate to 0. Scan from 0. If duplicate is 0, The copy is a copy of rendered, Place copy into seen.
To glue from spot (a whole number). If spot is more than the last position of word, finish, return. Set target to the slice of word from spot to spot plus 1. Set found to -1. Search from 0. The letter is found. Place item letter of codes into rendered. Glue from spot plus 1.
For each entry in words.
Set word to entry. Set rendered to empty text. Glue from 0.
Report the number of items in seen.
Keep a shared numbers holding 1, 2, 3, 4, 5, 6, 7, and 8. Keep a shared count of 0. Keep a shared whole of 0. Set count to 8. Set whole to 36. Keep a shared possible of 0. Keep a shared last of the last position of numbers.
To pick from spot (a whole number) with chosen (a whole number) and total (a whole number). If possible is 1, return. If spot is more than last, If chosen is more than 0 and chosen is less than count and total times count is whole times chosen, set possible to 1. If spot is more than last, return. Pick from spot plus 1 with chosen plus 1 and total plus item spot of numbers. Pick from spot plus 1 with chosen and total.
Pick from 0 with 0 and 0. If possible is 1, show true, otherwise show false.
Keep a shared alphabet as empty text. Place "abcdefghijklmnopqrstuvwxyz" into alphabet. Keep a shared widths holding 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, and 10. Keep a shared sentence as empty text. Place "abcdefghijklmnopqrstuvwxyz" into sentence. Keep a shared target as empty text. Keep a shared found of 0. Keep a shared used of 0. Keep a shared sheets of 1.
To search from spot (a whole number). If spot is more than 25, return. The piece is the slice of alphabet from spot to spot plus 1. If piece matches target, set found to spot, return. Search from spot plus 1.
For every spot from 0 to the last position of sentence.
Set target to the slice of sentence from spot to spot plus 1. Set found to -1. Search from 0. The letter is found. The room is item letter of widths. If used plus room is more than 100, add 1 to sheets, set used to room, otherwise add room to used.
Show sheets. Show used.
The grid is a list of 3, 0, 8, 4, 2, 4, 5, 7, 9, 2, 6, 3, 0, 3, 1, and 0. The size is 4. The rowtops is a list of 4 zeros. The columntops is a list of 4 zeros.
For every row from 0 to size minus 1.
For every column from 0 to size minus 1.
The value is item (row times size plus column) of grid. If value is more than item row of rowtops, set item row of rowtops to value. If value is more than item column of columntops, set item column of columntops to value.
The total is 0.
For every row from 0 to size minus 1.
For every column from 0 to size minus 1.
The spot is row times size plus column. The value is item spot of grid. The ceiling is item row of rowtops. If item column of columntops is less than ceiling, set ceiling to item column of columntops. Add ceiling minus value to total.
Show total.
The portions is 2. Keep a shared chance as a decimal.
To serve from first (a whole number) at second (a whole number) with weight (a decimal). If first is at most 0 and second is at most 0, add weight times 0.5 to chance, return. If first is at most 0, add weight to chance, return. If second is at most 0, return. Serve from first minus 4 at second with weight times 0.25. Serve from first minus 3 at second minus 1 with weight times 0.25. Serve from first minus 2 at second minus 2 with weight times 0.25. Serve from first minus 1 at second minus 3 with weight times 0.25.
Serve from portions at portions with 1.0. Report chance.
Keep a shared source as empty text. Place "heeellooo" into source. Keep a shared words holding "hello", "hi", and "helo". Keep a shared word as empty text. Keep a shared targetchar as empty text. Keep a shared sourcecount of 0. Keep a shared wordcount of 0. Keep a shared good of 0. Keep a shared lastsource of 0. Keep a shared lastword of 0. Set lastsource to the last position of source.
To measure source from spot (a whole number). If spot is more than lastsource, return. The symbol is the slice of source from spot to spot plus 1. If symbol does not match targetchar, return. Add 1 to sourcecount. Measure source from spot plus 1.
To measure word from spot (a whole number). If spot is more than lastword, return. The symbol is the slice of word from spot to spot plus 1. If symbol does not match targetchar, return. Add 1 to wordcount. Measure word from spot plus 1.
To check from first (a whole number) with second (a whole number). If good is 0, return. If first is more than lastsource and second is more than lastword, return. If first is more than lastsource, set good to 0, return. If second is more than lastword, set good to 0, return. The sourcechar is the slice of source from first to first plus 1. The wordchar is the slice of word from second to second plus 1. If sourcechar does not match wordchar, set good to 0, return. Set targetchar to sourcechar. Set sourcecount to 0. Measure source from first. Set targetchar to wordchar. Set wordcount to 0. Measure word from second. If sourcecount is not wordcount and sourcecount is less than 3, set good to 0, return. If sourcecount is not wordcount and wordcount is more than sourcecount, set good to 0, return. Check from first plus sourcecount with second plus wordcount.
The total is 0.
For each entry in words.
Set word to entry. Set lastword to the last position of word. Set good to 1. Check from 0 with 0. If good is 1, add 1 to total.
Show total.
The numbers is a list of 1, 1, and 2. The last is the last position of numbers. The count is the number of items in numbers. The mixed is 0.
For every spot from 0 to last.
The mixed is exclusive or of mixed and item spot of numbers.
If mixed is 0, show true. If mixed is not 0 and count modulo 2 is 0, show true. If mixed is not 0 and count modulo 2 is 1, show false.
The visits is an empty list of text. Place "9001 discuss.leetcode.com" into visits. Keep a shared domain as empty text. Keep a shared amount of 0. Keep a shared names as an empty list of text. Keep a shared totals as an empty list of whole numbers. Keep a shared suffix as empty text. Keep a shared found of 0. Keep a shared counttext as empty text.
To seek from spot (a whole number). If spot is more than the last position of names, return. If item spot of names matches suffix, set found to spot, return. Seek from spot plus 1.
To gather from start (a whole number). The finish is the last position of domain. Increase finish by 1. Set suffix to the slice of domain from start to finish. Set found to -1. Seek from 0. If found is at least 0, The slot is found, Set item slot of totals to item slot of totals plus amount. If found is less than 0, The copy is a copy of suffix, Place copy into names, Place amount into totals.
To close. Gather from 0.
For every spot from 0 to the last position of domain.
If spot is more than 0 and character spot of domain is ".", gather from spot plus 1.
To walk from spot (a whole number). If spot is more than the last position of counttext, close, return. The digit is the digit value of character spot of counttext. Set amount to amount times 10 plus digit. Walk from spot plus 1.
For each entry in visits.
The parts is split entry by " ". Set counttext to empty text. Place item 0 of parts into counttext. Set domain to empty text. Place item 1 of parts into domain. Set amount to 0. Walk from 0.
For every spot from 0 to the last position of names.
The line is format whole number item spot of totals as text. Place " " into line. Place item spot of names into line. The shown is a copy of line. Show shown.
Expected stdout
9001 discuss.leetcode.com
9001 leetcode.com
9001 com
The points is a list of 0, 0, 0, 1, 1, 0, 0, 2, and 2, 0. The count is 5. The best is 0.
For every first from 0 to count minus 1.
For every second from first plus 1 to count minus 1.
For every third from second plus 1 to count minus 1.
The left is item (second times 2) of points minus item (first times 2) of points. The upper is item (second times 2 plus 1) of points minus item (first times 2 plus 1) of points. The right is item (third times 2) of points minus item (first times 2) of points. The lower is item (third times 2 plus 1) of points minus item (first times 2 plus 1) of points. The cross is left times lower minus upper times right. If cross is less than 0, set cross to 0 minus cross. If cross is more than best, set best to cross.
The area is best as a decimal divided by 2.0. Report area.
Keep a shared numbers holding 9, 1, 2, 3, and 9. Keep a shared count of 0. Keep a shared groups of 0. Set count to 5. Set groups to 3. Keep a shared prefix as an empty list of whole numbers. Place 0 into prefix.
For every spot from 0 to count minus 1.
The running is item spot of prefix plus item spot of numbers. Place running into prefix.
Keep a shared table as an empty list of decimals. The size is (groups plus 1) times (count plus 1).
For every spot from 0 to size minus 1.
Place 0.0 into table.
Keep a shared choice as a decimal.
To search from start (a whole number) with group (a whole number). Set choice to -1.0.
For every cut from start plus 1 to count minus group plus 1.
The leftsum is item cut of prefix minus item start of prefix. The span is (cut minus start) as a decimal. The leftavg is leftsum as a decimal divided by span. The right is item ((group minus 1) times (count plus 1) plus cut) of table. The candidate is leftavg plus right. If candidate is more than choice, set choice to candidate.
For every start from 0 to count minus 1.
The end is count. The total is item end of prefix minus item start of prefix. The leftlength is (count minus start) as a decimal. The average is total as a decimal divided by leftlength. Set item ((count plus 1) plus start) of table to average.
For every group from 2 to groups.
For every start from 0 to count minus group.
Search from start with group. Set item (group times (count plus 1) plus start) of table to choice.
The answer is item (groups times (count plus 1)) of table. Report answer.
Keep a shared values holding 1, 0, 0, and 1. Keep a shared lefts holding -1, 2, -1, and -1. Keep a shared rights holding 1, 3, -1, and -1. Keep a shared alive holding 0, 0, 0, and 0. Keep a shared kept holding 1, 1, 1, and 1.
To trim from node (a whole number). If node is less than 0, return. The left is item node of lefts. The right is item node of rights. If left is at least 0, trim from left. If right is at least 0, trim from right. The present is item node of values. If left is at least 0 and item left of alive is 1, set present to 1. If right is at least 0 and item right of alive is 1, set present to 1. Set item node of alive to present. If present is 0, set item node of kept to 0. If left is at least 0 and item left of alive is 0, set item node of lefts to -1. If right is at least 0 and item right of alive is 0, set item node of rights to -1.
Trim from 0. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The pieces is an empty list of text.
Repeat while head is less than count.
The node is item head of queue. Add 1 to head. If node is less than 0, Place "null" into pieces. If node is at least 0, The piece is format whole number item node of values as text, Place piece into pieces. If node is at least 0 and item node of kept is 1, Place item node of lefts into queue, Place item node of rights into queue, add 2 to count.
Repeat while the last position of pieces is at least 0.
The tail is the last position of pieces. The tailpiece is item tail of pieces. If tailpiece matches "null", remove the last item from pieces, otherwise stop.
The line is join pieces with ",". Display line.
Keep a shared stops holding 1, 2, 7, 3, 6, and 7. Keep a shared begins holding 0 and 3. Keep a shared finishes holding 2 and 5. Keep a shared links as an empty list of whole numbers.
For every spot from 0 to 63.
Place 0 into links.
To connect from first (a whole number) with second (a whole number). Set item (first times 8 plus second) of links to 1. Set item (second times 8 plus first) of links to 1.
To weave from route (a whole number). The start is item route of begins. The finish is item route of finishes.
For every first from start to finish.
For every second from start to finish.
The leftstop is item first of stops. The rightstop is item second of stops. Connect from leftstop with rightstop.
For every route from 0 to 1.
Weave from route.
The visited is a list of 8 zeros. The distances is a list of 8 zeros. The queue is an empty list of whole numbers. Place 1 into queue. Set item 1 of visited to 1. The head is 0. The count is 1.
Repeat while head is less than count.
The node is item head of queue. Add 1 to head.
For every other from 0 to 7.
If item (node times 8 plus other) of links is 1 and item other of visited is 0.
Set item other of visited to 1. Set item other of distances to item node of distances plus 1. Place other into queue. Add 1 to count.
Show item 6 of distances.
Keep a shared content as empty text. Place "123" into content. Keep a shared lefts as an empty list of text. Keep a shared rights as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared side of 0.
To resetleft.
Repeat while the number of items in lefts is more than 0.
Remove the last item from lefts.
To resetright.
Repeat while the number of items in rights is more than 0.
Remove the last item from rights.
To examine from start (a whole number) with finish (a whole number). The firstsymbol is the slice of content from start to start plus 1. The lastsymbol is the slice of content from finish minus 1 to finish. The chosen is empty text. The plain is 1. The leadzero is 0. If firstsymbol is "0", set leadzero to 1. The longpart is 0. If finish minus start is more than 1, set longpart to 1. The invalid is 0. If leadzero is 1 and longpart is 1, set invalid to 1. If invalid is 1, set plain to 0. If plain is 1, set chosen to the slice of content from start to finish. If plain is 1 and side is 0, Place chosen into lefts. If plain is 1 and side is 1, Place chosen into rights.
For every dot from start plus 1 to finish minus 1.
The lead is the slice of content from start to dot. The firstpart is the slice of content from start to start plus 1. The fraction is the slice of content from dot to finish. The decimal is 1. The innerzero is 0. If firstpart is "0", set innerzero to 1. The innerlong is 0. If dot minus start is more than 1, set innerlong to 1. The innerbad is 0. If innerzero is 1 and innerlong is 1, set innerbad to 1. If innerbad is 1, set decimal to 0. If lastsymbol is "0", set decimal to 0. Set chosen to empty text. Place lead into chosen. Place "." into chosen. Place fraction into chosen. If decimal is 1 and side is 0, Place chosen into lefts. If decimal is 1 and side is 1, Place chosen into rights.
The last is the last position of content.
For every cut from 1 to last.
Resetleft. Set side to 0. Examine from 0 with cut. Resetright. Set side to 1. Examine from cut with last plus 1.
For each left in lefts.
For each right in rights.
The coordinate is empty text. Place "(" into coordinate. Place left into coordinate. Place ", " into coordinate. Place right into coordinate. Place ")" into coordinate. Place coordinate into answers.
For each answer in answers.
Show answer.
The chain is a list of 0, 1, 2, and 3. The wanted is a list of 0, 1, and 3. The last is the last position of chain. The total is 0. The inside is 0.
For every spot from 0 to last.
The value is item spot of chain. The prior is inside. If wanted contains value and prior is 0, add 1 to total. If wanted contains value, set inside to 1, otherwise set inside to 0.
Show total.
Keep a shared powers holding 1, 2, 4, 8, 16, 32, 64, and 128. Keep a shared exponent of 0. The target is 3. Keep a shared ways as an empty list of whole numbers.
For every spot from 0 to target.
Place 0 into ways.
To seek from value (a whole number). Set exponent to 0.
For every place from 0 to 7.
If item place of powers is at most value, set exponent to place.
To improve from step (a whole number) with power (a whole number). The base is item power of powers. The won is item (base minus 1) of ways. The start is base minus 1.
For every shorter from 0 to power minus 1.
The offset is step minus start. The addon is item shorter of powers. The landing is offset plus addon minus 1. The back is item landing of ways. The candidate is won plus 1 plus shorter plus 1 plus back. If candidate is less than item step of ways, set item step of ways to candidate.
Set item 0 of ways to 0.
For every step from 1 to target.
Seek from step. The power is exponent. The base is item power of powers. The high is item (power plus 1) of powers. The top is high minus 1. The won is item (base minus 1) of ways. If step is top, set item step of ways to power plus 1. If step is not top, set item step of ways to won plus 1 plus 1 plus item (top minus step) of ways. If power is more than 0, improve from step with power.
Show item target of ways.
Keep a shared uppers as empty text. Place "ABCDEFGHIJKLMNOPQRSTUVWXYZ" into uppers. Keep a shared lowers as empty text. Place "abcdefghijklmnopqrstuvwxyz" into lowers. Keep a shared source as empty text. Place "Bob hit a ball, the hit BALL flew far after it was hit." into source. Keep a shared target as empty text. Keep a shared lowered as empty text. Keep a shared found of 0. Keep a shared place of 0. Keep a shared targetword as empty text. Keep a shared banned as an empty list of text. Place "hit" into banned. Keep a shared forbid of 0. Keep a shared counts as an empty list of whole numbers.
To seek from spot (a whole number). If spot is more than 25, return. The piece is the slice of uppers from spot to spot plus 1. If piece matches target, set found to spot, return. Seek from spot plus 1.
To soften from spot (a whole number). The symbol is character spot of source. Set lowered to the slice of source from spot to spot plus 1. The capital is 0. If symbol is between "A" and "Z", set capital to 1. Set found to 0. If capital is 1, set target to the slice of source from spot to spot plus 1. If capital is 1, seek from 0. If capital is 1, The small is the slice of lowers from found to found plus 1, Set lowered to small.
To forbid. Set forbid to 0.
For every spot from 0 to the last position of banned.
If item spot of banned matches targetword, set forbid to 1.
To raise from spot (a whole number). Increase item spot of counts by 1.
To locate. Set place to -1.
For every spot from 0 to the last position of seen.
If item spot of seen matches targetword, set place to spot.
The last is the last position of source. The normalized is empty text.
For every spot from 0 to last.
Soften from spot. Place lowered into normalized.
The washed is a copy of normalized. The washedlast is the last position of washed. The words is an empty list of text. The current is empty text.
For every spot from 0 to washedlast.
The symbol is character spot of washed. The letter is 0. If symbol is between "a" and "z", set letter to 1. If letter is 1, Place symbol into current. If letter is 0 and the length of current is more than 0, The copy is a copy of current, Place copy into words, Set current to empty text.
If the length of current is more than 0, The tail is a copy of current, Place tail into words. Keep a shared seen as an empty list of text.
For each word in words.
Set targetword to word. Forbid. If forbid is 1, skip to the next one. Locate. The slot is place. If place is less than 0, The fresh is a copy of word, Place fresh into seen, Place 1 into counts. If place is at least 0, raise from slot.
The best is 0. The answer is empty text.
For every spot from 0 to the last position of counts.
If item spot of counts is more than best, set best to item spot of counts, set answer to item spot of seen.
Show answer.
Keep a shared words holding "time", "me", and "bell". Keep a shared covered of 0. Keep a shared measured of 0. Keep a shared total of 0.
To measure from spot (a whole number). Set measured to 0. The word is item spot of words.
For every place from 0 to the last position of word.
Add 1 to measured.
To suffix from other (a whole number) with spot (a whole number). The word is item other of words. Measure from other. The wordsize is measured. Measure from spot. The heresize is measured. The start is wordsize minus heresize. The tail is the slice of word from start to wordsize. If tail matches item spot of words, set covered to 1.
To cover from spot (a whole number). Set covered to 0. Measure from spot. The heresize is measured.
For every other from 0 to the last position of words.
Measure from other. The othersize is measured. If other is not spot and othersize is more than heresize, suffix from other with spot.
To extend from spot (a whole number). Measure from spot. The size is measured. Add size plus 1 to total.
For every spot from 0 to the last position of words.
Cover from spot. If covered is 0, extend from spot.
Show total.
The source is "loveleetcode". The target is "e". The last is the last position of source. The distances is an empty list of whole numbers.
For every spot from 0 to last.
Place 1000 into distances.
The nearest is 1000.
For every spot from 0 to last.
The symbol is character spot of source. If symbol is "e", set nearest to 0, otherwise add 1 to nearest. Set item spot of distances to nearest.
Set nearest to 1000.
For every step from 0 to last.
The spot is last minus step. The symbol is character spot of source. If symbol is "e", set nearest to 0, otherwise add 1 to nearest. If nearest is less than item spot of distances, set item spot of distances to nearest.
For each value in distances.
Show value.
The fronts is a list of 1, 2, 4, 4, and 7. The backs is a list of 1, 3, 4, 1, and 3. The last is the last position of fronts. The present is a list of 8 zeros. The blocked is a list of 8 zeros.
For every spot from 0 to last.
The front is item spot of fronts. The back is item spot of backs. Set item front of present to 1. Set item back of present to 1. If front is back, set item front of blocked to 1.
The best is 100.
For every value from 0 to 7.
If item value of present is 1 and item value of blocked is 0 and value is less than best, set best to value.
If best is 100, show 0, otherwise show best.
The numbers is a list of 2, 4, 5, and 10. Sort numbers. The last is the last position of numbers. The ways is an empty list of whole numbers.
For every spot from 0 to last.
Place 0 into ways.
For every spot from 0 to last.
Set item spot of ways to 1.
For every left from 0 to spot minus 1.
For every right from left to spot minus 1.
The product is item left of numbers times item right of numbers.
If product is item spot of numbers.
The leftways is item left of ways. The rightways is item right of ways. If left is right, set item spot of ways to item spot of ways plus leftways times rightways. If left is not right, set item spot of ways to item spot of ways plus 2 times leftways times rightways.
The total is 0.
For each value in ways.
Add value to total.
Show total.
Keep a shared words as an empty list of text. The sentence is "I speak Goat Latin". Set words to split sentence by " ". Keep a shared first as empty text. Keep a shared converted as empty text. Keep a shared vowel of 0.
To classify. Set vowel to 0. If first is "a", set vowel to 1. If first is "e", set vowel to 1. If first is "i", set vowel to 1. If first is "o", set vowel to 1. If first is "u", set vowel to 1. If first is "A", set vowel to 1. If first is "E", set vowel to 1. If first is "I", set vowel to 1. If first is "O", set vowel to 1. If first is "U", set vowel to 1.
To pad from count (a whole number).
For every step from 0 to count.
Place "a" into converted.
The answers is an empty list of text. The position is 0.
For every spot from 0 to the last position of words.
The word is item spot of words. Set first to the slice of word from 0 to 1. Classify. Set converted to empty text. The ending is the last position of word. The end is ending plus 1. The rest is the slice of word from 1 to end. If vowel is 1, Place word into converted. If vowel is 0, Place rest into converted, Place first into converted. Place "ma" into converted. Pad from position. Place converted into answers. Add 1 to position.
The line is join answers with " ". Show line.
The ages is a list of 20, 30, 100, 110, and 120. Keep a shared good of 0.
To test from older (a whole number) with younger (a whole number). Set good to 0. The lowerbound is older divided by 2 plus 7. If younger is more than lowerbound and younger is at most older and younger is at most 100, set good to 1. If younger is more than lowerbound and younger is at most older and older is at least 100, set good to 1.
The total is 0.
For every first from 0 to the last position of ages.
For every second from 0 to the last position of ages.
Test from item first of ages with item second of ages. If first is not second and good is 1, add 1 to total.
Show total.
Keep a shared difficulty holding 2, 4, 6, 8, and 10. Keep a shared profit holding 10, 20, 30, 40, and 50. The workers is a list of 4, 5, 6, and 7. Keep a shared best of 0.
To score from ability (a whole number). Set best to 0.
For every job from 0 to the last position of difficulty.
If item job of difficulty is at most ability and item job of profit is more than best, set best to item job of profit.
The total is 0.
For each worker in workers.
Score from worker. Add best to total.
Show total.
Keep a shared chart holding 1, 0, 0, and 1. Keep a shared rows of 0. Keep a shared columns of 0. Set rows to 2. Set columns to 2. Keep a shared labels as an empty list of whole numbers. Keep a shared sizes as an empty list of whole numbers. Keep a shared tint of 0. Keep a shared count of 0.
For every spot from 0 to 3.
Place -1 into labels.
To paint from node (a whole number). If item node of chart is 0, return. If item node of labels is not -1, return. Set item node of labels to tint. Add 1 to count. The row is node divided by columns. The column is node modulo columns. If row is more than 0, paint from node minus columns. If row is less than rows minus 1, paint from node plus columns. If column is more than 0, paint from node minus 1. If column is less than columns minus 1, paint from node plus 1.
For every node from 0 to 3.
If item node of chart is 1 and item node of labels is -1.
Set count to 0. Paint from node. Place count into sizes. Increase tint by 1.
The best is 0.
For every node from 0 to 3.
If item node of chart is 0.
The near is an empty list of whole numbers. The row is node divided by columns. The column is node modulo columns. If row is more than 0 and item (node minus columns) of chart is 1, Place item (node minus columns) of labels into near. If row is less than rows minus 1 and item (node plus columns) of chart is 1, Place item (node plus columns) of labels into near. If column is more than 0 and item (node minus 1) of chart is 1, Place item (node minus 1) of labels into near. If column is less than columns minus 1 and item (node plus 1) of chart is 1, Place item (node plus 1) of labels into near. The candidate is 1. If candidate is more than best, set best to candidate. The seen is an empty list of whole numbers.
For each label in near.
If seen contains label, skip to the next one. Place label into seen. The gain is item label of sizes. Add gain to candidate. If candidate is more than best, set best to candidate.
If best is 0, set best to rows times columns. Show best.