[{"id":1,"slug":"two-sum","title":"Two Sum","difficulty":"Easy","category":"Array","code":"Start with the list of numbers 2, 7, 11, and 15. The target is 9.\nFor every first from 0 to the last position of numbers.\nFor every second from one more than first to the last position of numbers, if item first of numbers plus item second of numbers is target, display first, display second, then stop.\n","expected":"0\n1\n","step_budget":2000000},{"id":2,"slug":"add-two-numbers","title":"Add Two Numbers","difficulty":"Medium","category":"Math","code":"The firstlist holds 2, 4, and 3, while the secondlist holds 5, 6, and 4. Start with an empty list for the answer, a carry of 0, and a position of 0. The firstlast is the last position of firstlist. The secondlast is the last position of secondlist.\nRepeat while position is at most firstlast or position is at most secondlast or carry is 1.\nThe sum is carry. If position is at most firstlast, set sum to sum plus item position of firstlist. If position is at most secondlast, set sum to sum plus item position of secondlist. Place sum modulo 10 into answer. Set carry to sum divided by 10. Add 1 to position.\n\nFor each value in answer, show value.\n","expected":"7\n0\n8\n","step_budget":2000000},{"id":3,"slug":"longest-substring-without-repeating-characters","title":"Longest Substring Without Repeating Characters","difficulty":"Medium","category":"String","code":"The word is \"abcabcbb\". The last is the last position of word. The best is 0.\nFor every start from 0 to last.\nFor every finish from start to last.\nThe repeated is 0. For every earlier from start to one less than finish, if character earlier of word is character finish of word, add 1 to repeated. The span is finish minus start plus 1. If repeated is 0 and span is greater than best, set best to span.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":4,"slug":"median-of-two-sorted-arrays","title":"Median of Two Sorted Arrays","difficulty":"Hard","category":"Array","code":"The first is a list of 1 and 3. The second is a list of 2. The combined is an empty list of whole numbers. For each number in first, Place number into combined. For each number in second, Place number into combined. Sort combined. The middle is the midpoint of 0 and the last position of combined. Display item middle of combined.\n","expected":"2\n","step_budget":2000000},{"id":5,"slug":"longest-palindromic-substring","title":"Longest Palindromic Substring","difficulty":"Medium","category":"String","code":"The word is \"babad\". The last is the last position of word. The best is empty text.\nFor every start from 0 to last.\nFor every finish from start to last.\nThe piece is the slice of word from start to one more than finish. The reversed is empty text. For every step from 0 to finish minus start, The position is finish minus step, Place character position of word into reversed. The piecelength is the length of piece. The bestlength is the length of best. If piece is reversed, if piecelength is greater than bestlength, set best to piece.\n\nReport best.\n","expected":"bab\n","step_budget":2000000},{"id":6,"slug":"zigzag-conversion","title":"Zigzag Conversion","difficulty":"Medium","category":"String","code":"The source is \"PAYPALISHIRING\". The rows is 3. The lastrow is rows minus 1. The store is an empty list of text.\nFor every row from 0 to lastrow.\nPlace \"\" into store.\n\nThe row is 0. The step is 1. The sourcelast is the last position of source.\nFor every position from 0 to sourcelast.\nPlace character position of source into item row of store. If row is 0 and lastrow is more than 0, set step to 1. If row is lastrow and lastrow is more than 0, set step to 0 minus 1. Increase row by step.\n\nThe result is join store with \"\". Show result.\n","expected":"PAHNAPLSIIGYIR\n","step_budget":2000000},{"id":7,"slug":"reverse-integer","title":"Reverse Integer","difficulty":"Medium","category":"Math","code":"Start with the numbers 123, -123, 120, and 1534236469.\nFor each value in numbers.\nThe sign is 1. The magnitude is value. If magnitude is less than 0, set sign to -1, set magnitude to 0 minus magnitude. The reversed is 0. Repeat while magnitude is more than 0, set digit to magnitude modulo 10, set reversed to reversed times 10 plus digit, set magnitude to magnitude divided by 10. If reversed is more than 2147483647, display 0, otherwise display reversed times sign.\n","expected":"321\n-321\n21\n0\n","step_budget":2000000},{"id":8,"slug":"string-to-integer-atoi","title":"String to Integer (atoi)","difficulty":"Medium","category":"String","code":"The word is \"   -42\". The final is one less than the number of characters in word. The position is 0. The value is 0. The sign is 1.\nRepeat while position is at most final and character position of word is 32.\nAdd 1 to position.\n\nIf position is at most final and character position of word is 45, set sign to -1, add 1 to position. If position is at most final and character position of word is 43, add 1 to position.\nRepeat while position is at most final and character position of word is between \"0\" and \"9\".\nThe digit is the digit value of character position of word. Set value to value times 10 plus digit. Add 1 to position.\n\nIf sign is -1, set value to 0 minus value. If value is more than 2147483647, set value to 2147483647. If value is less than -2147483648, set value to -2147483648. Report value.\n","expected":"-42\n","step_budget":2000000},{"id":9,"slug":"palindrome-number","title":"Palindrome Number","difficulty":"Easy","category":"Math","code":"The value is 121. The reversed is 0. The magnitude is value.\nRepeat while magnitude is more than 0.\nSet digit to magnitude modulo 10. Set reversed to reversed times 10 plus digit. Set magnitude to magnitude divided by 10.\n\nIf value is less than 0, show false. Otherwise, show reversed is value.\n","expected":"true\n","step_budget":2000000},{"id":10,"slug":"regular-expression-matching","title":"Regular Expression Matching","difficulty":"Hard","category":"String","code":"The text is \"aab\". The pattern is \"c*a*b\". The textsize is the number of characters in text. The patternsize is the number of characters in pattern. The width is patternsize plus 1. The height is textsize plus 1. The size is width times height. The table is a list of size zeros. Set item 0 of table to 1.\nFor every column from 2 to patternsize.\nIf character (column minus 1) of pattern is 42 and item (column minus 2) of table is 1, set item column of table to 1.\n\nFor every row from 1 to textsize.\nFor every column from 1 to patternsize.\nThe index is row times width plus column. The symbol is character (column minus 1) of pattern. If symbol is not 42 and symbol is 46 and item (index minus width minus 1) of table is 1, set item index of table to 1. If symbol is not 42 and symbol is character (row minus 1) of text and item (index minus width minus 1) of table is 1, set item index of table to 1. If symbol is 42 and column is more than 1 and item (index minus 2) of table is 1, set item index of table to 1. If symbol is 42 and column is more than 1 and character (column minus 2) of pattern is 46 and item (index minus width) of table is 1, set item index of table to 1. If symbol is 42 and column is more than 1 and character (column minus 2) of pattern is character (row minus 1) of text and item (index minus width) of table is 1, set item index of table to 1.\n\nThe last is one less than size. If item last of table is 1, display true. Otherwise, display false.\n","expected":"true\n","step_budget":2000000},{"id":11,"slug":"container-with-most-water","title":"Container With Most Water","difficulty":"Medium","category":"Array","code":"The heights is a list of 1, 8, 6, 2, 5, 4, 8, 3, and 7. The bestarea is 0.\nFor every first from 0 to the last position of heights.\nFor every second from one more than first to the last position of heights.\nThe width is second minus first. The lowheight is the smaller of item first of heights and item second of heights. The area is the product of width and lowheight. If area is greater than bestarea, set bestarea to area.\n\nReport bestarea.\n","expected":"49\n","step_budget":2000000},{"id":12,"slug":"integer-to-roman","title":"Integer to Roman","difficulty":"Medium","category":"String","code":"The value is 1994. The result is empty text. Repeat while value is at least 1000, Place \"M\" into result, set value to value minus 1000. If value is at least 900, Place \"CM\" into result, set value to value minus 900. If value is at least 500, Place \"D\" into result, set value to value minus 500. If value is at least 400, Place \"CD\" into result, set value to value minus 400. Repeat while value is at least 100, Place \"C\" into result, set value to value minus 100. If value is at least 90, Place \"XC\" into result, set value to value minus 90. If value is at least 50, Place \"L\" into result, set value to value minus 50. If value is at least 40, Place \"XL\" into result, set value to value minus 40. Repeat while value is at least 10, Place \"X\" into result, set value to value minus 10. If value is at least 9, Place \"IX\" into result, set value to value minus 9. If value is at least 5, Place \"V\" into result, set value to value minus 5. If value is at least 4, Place \"IV\" into result, set value to value minus 4. Repeat while value is at least 1, Place \"I\" into result, set value to value minus 1. Show result.\n","expected":"MCMXCIV\n","step_budget":2000000},{"id":13,"slug":"roman-to-integer","title":"Roman to Integer","difficulty":"Easy","category":"String","code":"The word is \"MCMXCIV\". The final is one less than the number of characters in word. The total is 0.\nFor every position from 0 to final.\nThe current is 0. The following is 0. The symbol is character position of word. If symbol is 77, set current to 1000. If symbol is 68, set current to 500. If symbol is 67, set current to 100. If symbol is 76, set current to 50. If symbol is 88, set current to 10. If symbol is 86, set current to 5. If symbol is 73, set current to 1. The nextposition is one more than position. If position is less than final, set following to character nextposition of word. If following is 77, set following to 1000. If following is 68, set following to 500. If following is 67, set following to 100. If following is 76, set following to 50. If following is 88, set following to 10. If following is 86, set following to 5. If following is 73, set following to 1. If current is less than following, set total to total minus current, otherwise set total to total plus current.\n\nDisplay total.\n","expected":"1994\n","step_budget":2000000},{"id":14,"slug":"longest-common-prefix","title":"Longest Common Prefix","difficulty":"Easy","category":"Array","code":"The words is a list of \"flower\", \"flow\", and \"flight\". The reference is item 0 of words. The limit is the number of characters in reference.\nFor each word in words.\nThe size is the number of characters in word. If size is less than limit, set limit to size.\n\nThe count is the number of items in words. The prefix is empty text. The last is limit minus 1.\nFor every position from 0 to last.\nThe matches is 0. For each word in words, if character position of word is character position of reference, add 1 to matches. If matches is count, Place character position of reference into prefix, otherwise stop.\n\nReport prefix.\n","expected":"fl\n","step_budget":2000000},{"id":15,"slug":"3sum","title":"3Sum","difficulty":"Medium","category":"Array","code":"The nums is a list of -1, 0, 1, and 2. Sort nums. The last is the last position of nums.\nFor every first from 0 to last.\nThe second is one more than first. The third is last.\nRepeat while second is less than third.\nThe total is item first of nums plus item second of nums plus item third of nums. If total is less than 0, add 1 to second. If total is more than 0, subtract 1 from third. If total is 0, show item first of nums, show item second of nums, show item third of nums, show \"---\", add 1 to second, subtract 1 from third.\n","expected":"-1\n0\n1\n---\n","step_budget":2000000},{"id":16,"slug":"3sum-closest","title":"3Sum Closest","difficulty":"Medium","category":"Array","code":"The nums is a list of -1, 2, 1, and -4. The target is 1. Sort nums. The last is the last position of nums. The best is 0. The bestdistance is 2147483647.\nFor every first from 0 to last.\nThe second is one more than first. The third is last.\nRepeat while second is less than third.\nThe total is item first of nums plus item second of nums plus item third of nums. The difference is total minus target. If difference is less than 0, set difference to 0 minus difference. If difference is less than bestdistance, set bestdistance to difference, set best to total. If total is less than target, add 1 to second. If total is more than target, subtract 1 from third. If total is target, add 1 to second, subtract 1 from third.\n\nDisplay best.\n","expected":"2\n","step_budget":2000000},{"id":17,"slug":"letter-combinations-of-a-phone-number","title":"Letter Combinations of a Phone Number","difficulty":"Medium","category":"String","code":"Keep a shared digits as empty text. Place \"23\" into digits. Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared current as empty text. Keep a shared answers as an empty list of text. Keep a shared copy as empty text.\nTo build from position (a whole number). If position is 2, The copy is a copy of current, Place copy into answers, then return. The digit is the digit value of character position of digits. The start is (digit minus 2) times 3.\nFor every offset from 0 to 2.\nPlace character (start plus offset) of alphabet into current. Build from position plus 1. Remove last character from current.\n\nBuild from 0. For each answer in answers, report answer.\n","expected":"ad\nae\naf\nbd\nbe\nbf\ncd\nce\ncf\n","step_budget":2000000},{"id":18,"slug":"4sum","title":"4Sum","difficulty":"Medium","category":"Array","code":"The nums is a list of 1, 0, -1, and 2. The target is 2. Sort nums. The last is the last position of nums.\nFor every first from 0 to last.\nFor every second from one more than first to last.\nFor every third from one more than second to last.\nFor every fourth from one more than third to last.\nThe total is item first of nums plus item second of nums plus item third of nums plus item fourth of nums. If total is target, show item first of nums, show item second of nums, show item third of nums, show item fourth of nums, show \"---\".\n","expected":"-1\n0\n1\n2\n---\n","step_budget":2000000},{"id":19,"slug":"remove-nth-node-from-end-of-list","title":"Remove Nth Node From End of List","difficulty":"Medium","category":"Two Pointers","code":"The values is a list of 1, 2, 3, 4, and 5. The last is the last position of values. The position is last plus 1 minus 2. Remove item position of values. For each value in values, display value.\n","expected":"1\n2\n3\n5\n","step_budget":2000000},{"id":20,"slug":"valid-parentheses","title":"Valid Parentheses","difficulty":"Easy","category":"String","code":"The word is \"()[]{}\". The last is the last position of word. The stack is an empty list of whole numbers. The invalid is 0. The top is 0.\nFor every position from 0 to last.\nThe symbol is character position of word. The size is the number of items in stack. If symbol is \"(\" or symbol is \"[\" or symbol is \"{\", Place symbol into stack. If symbol is \")\" and size is 0, add 1 to invalid. If symbol is \")\" and size is more than 0, set top to item (size minus 1) of stack, remove the last item from stack, if top is not \"(\", add 1 to invalid. If symbol is \"]\" and size is 0, add 1 to invalid. If symbol is \"]\" and size is more than 0, set top to item (size minus 1) of stack, remove the last item from stack, if top is not \"[\", add 1 to invalid. If symbol is \"}\" and size is 0, add 1 to invalid. If symbol is \"}\" and size is more than 0, set top to item (size minus 1) of stack, remove the last item from stack, if top is not \"{\", add 1 to invalid.\n\nThe finalsize is the number of items in stack. If invalid is 0 and finalsize is 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":21,"slug":"merge-two-sorted-lists","title":"Merge Two Sorted Lists","difficulty":"Easy","category":"Linked List","code":"The first is a list of 1, 2, and 4. The second is a list of 1, 3, and 4. The combined is an empty list of whole numbers. For each number in first, Place number into combined. For each number in second, Place number into combined. Sort combined. For each number in combined, show number.\n","expected":"1\n1\n2\n3\n4\n4\n","step_budget":2000000},{"id":22,"slug":"generate-parentheses","title":"Generate Parentheses","difficulty":"Medium","category":"String","code":"Keep a shared current as empty text. Keep a shared answers as an empty list of text. Keep a shared copy as empty text.\nTo build from opened (a whole number) with closed (a whole number). If opened plus closed is 6, The copy is a copy of current, Place copy into answers, then return. If opened is less than 3, Place \"(\" into current, build from opened plus 1 with closed, remove last character from current. If closed is less than opened, Place \")\" into current, build from opened with closed plus 1, remove last character from current.\n\nBuild from 0 with 0. For each answer in answers, display answer.\n","expected":"((()))\n(()())\n(())()\n()(())\n()()()\n","step_budget":2000000},{"id":23,"slug":"merge-k-sorted-lists","title":"Merge k Sorted Lists","difficulty":"Hard","category":"Heap (Priority Queue)","code":"The first is a list of 1, 4, and 5. The second is a list of 1, 3, and 4. The third is a list of 2 and 6. The merged is an empty list of whole numbers.\nFor each value in first.\nPlace value into merged.\n\nFor each value in second.\nPlace value into merged.\n\nFor each value in third.\nPlace value into merged.\n\nSort merged. For each value in merged, report value.\n","expected":"1\n1\n2\n3\n4\n4\n5\n6\n","step_budget":2000000},{"id":24,"slug":"swap-nodes-in-pairs","title":"Swap Nodes in Pairs","difficulty":"Medium","category":"Linked List","code":"The values is a list of 1, 2, 3, and 4. The last is the last position of values.\nFor every position from 0 to last.\nIf position modulo 2 is 0 and position plus 1 is at most last, swap item position of values and item (position plus 1) of values.\n\nFor each value in values, show value.\n","expected":"2\n1\n4\n3\n","step_budget":2000000},{"id":25,"slug":"reverse-nodes-in-k-group","title":"Reverse Nodes in k-Group","difficulty":"Hard","category":"Linked List","code":"The values is a list of 1, 2, 3, 4, and 5. The groupsize is 2. The last is the last position of values. The start is 0.\nRepeat while start plus groupsize minus 1 is at most last.\nThe left is start. The right is start plus groupsize minus 1. Repeat while left is less than right, swap item left of values and item right of values, add 1 to left, subtract 1 from right. Increase start by groupsize.\n\nFor each value in values, display value.\n","expected":"2\n1\n4\n3\n5\n","step_budget":2000000},{"id":26,"slug":"remove-duplicates-from-sorted-array","title":"Remove Duplicates from Sorted Array","difficulty":"Easy","category":"Array","code":"Start with the list of numbers 0, 0, 1, 1, 1, 2, 2, 3, 3, and 4. The unique is an empty list of whole numbers. For each number in the list, if unique does not contain the number, Place number into unique. Report the number of items in unique. For each number in unique, report number.\n","expected":"5\n0\n1\n2\n3\n4\n","step_budget":2000000},{"id":27,"slug":"remove-element","title":"Remove Element","difficulty":"Easy","category":"Array","code":"Start with the list of numbers 3, 2, 2, and 3. Remove every 3 from the list. Show the number of items in the list. For each item in the list, show item.\n","expected":"2\n2\n2\n","step_budget":2000000},{"id":28,"slug":"find-the-index-of-the-first-occurrence-in-a-string","title":"Find the Index of the First Occurrence in a String","difficulty":"Easy","category":"String","code":"The word is \"sadbutsad\". The needle is \"sad\". The wordlength is the number of characters in word. The needlelength is the number of characters in needle. The final is wordlength minus needlelength. The answer is -1.\nFor every position from 0 to final.\nThe finish is position plus needlelength. The piece is the slice of word from position to finish. If piece is needle, set answer to position, display answer, then stop.\n\nIf answer is -1, display -1.\n","expected":"0\n","step_budget":2000000},{"id":29,"slug":"divide-two-integers","title":"Divide Two Integers","difficulty":"Medium","category":"Math","code":"The top is 10. The bottom is 3. The quotient is 0.\nRepeat while top is at least bottom.\nDecrease top by bottom. Add 1 to quotient.\n\nReport quotient.\n","expected":"3\n","step_budget":2000000},{"id":30,"slug":"substring-with-concatenation-of-all-words","title":"Substring with Concatenation of All Words","difficulty":"Hard","category":"String","code":"Keep a shared text as empty text. Place \"barfoothefoobarman\" into text. Keep a shared words holding \"foo\" and \"bar\". Keep a shared word length as 0. Set word length to 3. Keep a shared word count as 0. Set word count to 2. Keep a shared used as an empty list of whole numbers. Keep a shared match of 0.\nTo verify from start (a whole number) at part (a whole number). If match is 1, return. If part is word count, set match to 1, return.\nFor every index from 0 to word count minus 1.\nThe offset is start plus part times word length. The piece is the slice of text from offset to offset plus word length. If used contains index, skip to the next one. If piece matches item index of words, Place index into used, verify from start at part plus 1, remove the last item from used, if match is 1, return.\n\nFor every start from 0 to 12.\nSet match to 0. Verify from start at 0. If match is 1, show start.\n","expected":"0\n9\n","step_budget":2000000},{"id":31,"slug":"next-permutation","title":"Next Permutation","difficulty":"Medium","category":"Array","code":"The nums is a list of 1, 2, and 3. The last is the last position of nums. The pivot is -1. The position is last minus 1.\nRepeat while position is at least 0.\nIf item position of nums is less than item (position plus 1) of nums, set pivot to position, break. Set position to one less than position.\n\nThe mark is last.\nIf pivot is at least 0.\nRepeat while item mark of nums is at most item pivot of nums.\nSet mark to one less than mark.\n\nIf pivot is at least 0, swap item pivot of nums and item mark of nums. The left is pivot plus 1. The right is last.\nRepeat while left is less than right.\nSwap item left of nums and item right of nums. Add 1 to left. Subtract 1 from right.\n\nFor each value in nums, display value.\n","expected":"1\n3\n2\n","step_budget":2000000},{"id":32,"slug":"longest-valid-parentheses","title":"Longest Valid Parentheses","difficulty":"Hard","category":"String","code":"The text is \"(()\". The last is the last position of text. The best is 0.\nFor every start from 0 to last.\nThe balance is 0.\nFor every end from start to last.\nIf character end of text is \"(\", add 1 to balance. If character end of text is \")\", subtract 1 from balance. If balance is less than 0, break. If balance is 0, The width is end minus start plus 1, if width is more than best, set best to width.\n\nReport best.\n","expected":"2\n","step_budget":2000000},{"id":33,"slug":"search-in-rotated-sorted-array","title":"Search in Rotated Sorted Array","difficulty":"Medium","category":"Array","code":"Start with the list of numbers 4, 5, 6, 7, 0, 1, and 2. The target is 0. The answer is -1.\nFor every position from 0 to the last position of numbers.\nIf item position of numbers is target, set answer to position, then stop.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":34,"slug":"find-first-and-last-position-of-element-in-sorted-array","title":"Find First and Last Position of Element in Sorted Array","difficulty":"Medium","category":"Array","code":"Start with the list of numbers 5, 7, 7, 8, 8, and 10. The target is 8. The first is -1. The last is -1.\nFor every position from 0 to the last position of numbers.\nIf item position of numbers is target and first is -1, set first to position. If item position of numbers is target, set last to position.\n\nDisplay first. Display last.\n","expected":"3\n4\n","step_budget":2000000},{"id":35,"slug":"search-insert-position","title":"Search Insert Position","difficulty":"Easy","category":"Array","code":"Start with the list of numbers 1, 3, 5, and 6. The target is 5. The count is the number of items in numbers. The foundposition is -1.\nFor every position from 0 to the last position of numbers.\nIf item position of numbers is target or item position of numbers is more than target, set foundposition to position, report foundposition, then stop.\n\nIf foundposition is -1, report count.\n","expected":"2\n","step_budget":2000000},{"id":36,"slug":"valid-sudoku","title":"Valid Sudoku","difficulty":"Medium","category":"Array","code":"The board is a list of 5, 3, 0, 0, 7, 0, 0, 0, 0, 6, 0, 0, 1, 9, 5, 0, 0, 0, 0, 9, 8, 0, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 0, 0, 3, 4, 0, 0, 8, 0, 3, 0, 0, 1, 7, 0, 0, 0, 2, 0, 0, 0, 6, 0, 6, 0, 0, 0, 0, 2, 8, 0, 0, 0, 0, 4, 1, 9, 0, 0, 5, 0, 0, 0, 0, 8, 0, 0, 7, 9. The invalid is 0.\nFor every row from 0 to 8.\nThe seen is an empty map.\nFor every column from 0 to 8.\nThe value is item (row times 9 plus column) of board. If value is more than 0 and seen has entry value, set invalid to 1. If value is more than 0, add 1 to entry value of seen.\n\nFor every column from 0 to 8.\nThe seen is an empty map.\nFor every row from 0 to 8.\nThe value is item (row times 9 plus column) of board. If value is more than 0 and seen has entry value, set invalid to 1. If value is more than 0, add 1 to entry value of seen.\n\nFor every box from 0 to 8.\nThe startrow is (box divided by 3) times 3. The startcolumn is (box modulo 3) times 3. The seen is an empty map.\nFor every inner row from 0 to 2.\nFor every inner column from 0 to 2.\nThe row is startrow plus inner row. The column is startcolumn plus inner column. The value is item (row times 9 plus column) of board. If value is more than 0 and seen has entry value, set invalid to 1. If value is more than 0, add 1 to entry value of seen.\n\nIf invalid is 0, show true. Otherwise, show false.\n","expected":"true\n","step_budget":3038288},{"id":37,"slug":"sudoku-solver","title":"Sudoku Solver","difficulty":"Hard","category":"Array","code":"Keep a shared board holding 5, 3, 0, 0, 7, 0, 0, 0, 0, 6, 0, 0, 1, 9, 5, 0, 0, 0, 0, 9, 8, 0, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 0, 0, 3, 4, 0, 0, 8, 0, 3, 0, 0, 1, 7, 0, 0, 0, 2, 0, 0, 0, 6, 0, 6, 0, 0, 0, 0, 2, 8, 0, 0, 0, 0, 4, 1, 9, 0, 0, 5, 0, 0, 0, 0, 8, 0, 0, 7, and 9.\n\nKeep a shared solved of 0. Keep a shared row safe as 0. Keep a shared column safe as 0. Keep a shared box safe as 0.\nTo check row at row (a whole number) with value (a whole number). Set row safe to 1.\nFor every column from 0 to 8.\nIf item (row times 9 plus column) of board is value, set row safe to 0, break.\n\nTo check column at column (a whole number) with value (a whole number). Set column safe to 1.\nFor every row from 0 to 8.\nIf item (row times 9 plus column) of board is value, set column safe to 0, break.\n\nTo check box at box (a whole number) with value (a whole number). Set box safe to 1. The startrow is (box divided by 3) times 3. The startcolumn is (box modulo 3) times 3.\nFor every inner row from 0 to 2.\nFor every inner column from 0 to 2.\nThe row is startrow plus inner row. The column is startcolumn plus inner column. If item (row times 9 plus column) of board is value, set box safe to 0, break.\n\nTo solve from position (a whole number). If solved is 1, return. If position is 81, set solved to 1, return. If item position of board is not 0, solve from position plus 1, return. The row is position divided by 9. The column is position modulo 9. The box is (row divided by 3) times 3 plus column divided by 3.\nFor every step from 0 to 8.\nThe digit is 9 minus step. Check row at row with digit. Check column at column with digit. Check box at box with digit.\nIf row safe is 1 and column safe is 1 and box safe is 1.\nSet item position of board to digit. Solve from position plus 1. If solved is 1, return. Set item position of board to 0.\n\nSolve from 0. For each value in board, display value.\n","expected":"5\n3\n4\n6\n7\n8\n9\n1\n2\n6\n7\n2\n1\n9\n5\n3\n4\n8\n1\n9\n8\n3\n4\n2\n5\n6\n7\n8\n5\n9\n7\n6\n1\n4\n2\n3\n4\n2\n6\n8\n5\n3\n7\n9\n1\n7\n1\n3\n9\n2\n4\n8\n5\n6\n9\n6\n1\n5\n3\n7\n2\n8\n4\n2\n8\n7\n4\n1\n9\n6\n3\n5\n3\n4\n5\n2\n8\n6\n1\n7\n9\n","step_budget":14674713},{"id":38,"slug":"count-and-say","title":"Count and Say","difficulty":"Medium","category":"String","code":"The current is empty text. Place \"1\" into current.\n\nThe built is empty text. The position is 0. The limit is the last position of current. The previous is character 0 of current. The run is 0.\nRepeat while position is at most limit.\nThe symbol is character position of current. If symbol is previous, add 1 to run. If symbol is not previous, Place the character for run into built, Place previous into built, set run to 1, set previous to symbol. Add 1 to position.\n\nPlace the character for run into built. Place previous into built. Set current to built.\n\nSet built to empty text. Set position to 0. Set limit to the last position of current. Set previous to character 0 of current. Set run to 0.\nRepeat while position is at most limit.\nThe symbol is character position of current. If symbol is previous, add 1 to run. If symbol is not previous, Place the character for run into built, Place previous into built, set run to 1, set previous to symbol. Add 1 to position.\n\nPlace the character for run into built. Place previous into built. Set current to built.\n\nSet built to empty text. Set position to 0. Set limit to the last position of current. Set previous to character 0 of current. Set run to 0.\nRepeat while position is at most limit.\nThe symbol is character position of current. If symbol is previous, add 1 to run. If symbol is not previous, Place the character for run into built, Place previous into built, set run to 1, set previous to symbol. Add 1 to position.\n\nPlace the character for run into built. Place previous into built. Set current to built.\n\nReport current.\n","expected":"1211\n","step_budget":2000000},{"id":39,"slug":"combination-sum","title":"Combination Sum","difficulty":"Medium","category":"Array","code":"Keep a shared nums holding 2, 3, 6, and 7. Keep a shared target of 7. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text.\nTo combine from index (a whole number) with total (a whole number). If total is target, The built is join parts with \",\", Place built into answers, then return. If total is more than target, return. If index is at least 4, return.\nFor every position from index to 3.\nThe value is item position of nums.\nIf total plus value is at most target.\nThe piece is format whole number value as text. Place piece into parts. Combine from position with total plus value. Remove the last item from parts.\n\nCombine from 0 with 0. For each answer in answers, show answer.\n","expected":"2,2,3\n7\n","step_budget":2000000},{"id":40,"slug":"combination-sum-ii","title":"Combination Sum II","difficulty":"Medium","category":"Array","code":"Keep a shared nums holding 10, 1, 2, 7, 6, 1, and 5. Sort nums. Keep a shared target of 8. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text.\nTo combine from index (a whole number) with total (a whole number). If total is target, The built is join parts with \",\", Place built into answers, then return. If total is more than target, return. If index is at least 7, return.\nFor every position from index to 6.\nIf position is more than index and item position of nums is item (position minus 1) of nums, skip to the next one. The value is item position of nums.\nIf total plus value is at most target.\nThe piece is format whole number value as text. Place piece into parts. Combine from position plus 1 with total plus value. Remove the last item from parts.\n\nCombine from 0 with 0. For each answer in answers, display answer.\n","expected":"1,1,6\n1,2,5\n1,7\n2,6\n","step_budget":2000000},{"id":41,"slug":"first-missing-positive","title":"First Missing Positive","difficulty":"Hard","category":"Array","code":"Start with the list of numbers 3, 4, -1, and 1.\nFor every candidate from 1 to one more than the number of items in the list.\nIf the list does not contain candidate, report candidate, then stop.\n","expected":"2\n","step_budget":2000000},{"id":42,"slug":"trapping-rain-water","title":"Trapping Rain Water","difficulty":"Hard","category":"Array","code":"The heights is a list of 0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, and 1. The water is 0.\nFor every position from 0 to the last position of heights.\nThe current is item position of heights. The lefthighest is 0. For every earlier from 0 to position, if item earlier of heights is greater than lefthighest, set lefthighest to item earlier of heights. The righthighest is 0. For every later from position to the last position of heights, if item later of heights is greater than righthighest, set righthighest to item later of heights. The boundary is the smaller of lefthighest and righthighest. The depth is boundary minus current. If depth is more than 0, add depth to water.\n\nShow water.\n","expected":"6\n","step_budget":2000000},{"id":43,"slug":"multiply-strings","title":"Multiply Strings","difficulty":"Medium","category":"String","code":"The first is \"123\". The second is \"456\". The lastfirst is the last position of first. The lastsecond is the last position of second. The firstdigits is an empty list of whole numbers. The seconddigits is an empty list of whole numbers.\nFor every position from 0 to lastfirst.\nThe at is lastfirst minus position. The digit is the digit value of character at of first. Place digit into firstdigits.\n\nFor every position from 0 to lastsecond.\nThe at is lastsecond minus position. The digit is the digit value of character at of second. Place digit into seconddigits.\n\nThe total is lastfirst plus lastsecond plus 2. The result is a list of total zeros.\nFor every left from 0 to lastfirst.\nFor every right from 0 to lastsecond.\nThe product is item left of firstdigits times item right of seconddigits. The index is left plus right. The sum is item index of result plus product. Set item index of result to sum modulo 10. Increase item (index plus 1) of result by sum divided by 10.\n\nThe resultlast is total minus 1. The output is empty text. The started is 0.\nFor every step from 0 to resultlast.\nThe at is resultlast minus step. The digit is item at of result.\nIf digit is more than 0 or started is 1 or step is resultlast.\nPlace the character for digit into output. Set started to 1.\n\nDisplay output.\n","expected":"56088\n","step_budget":2000000},{"id":44,"slug":"wildcard-matching","title":"Wildcard Matching","difficulty":"Hard","category":"String","code":"The text is \"adceb\". The pattern is \"*a*b\". The textsize is the number of characters in text. The patternsize is the number of characters in pattern. The width is patternsize plus 1. The height is textsize plus 1. The size is width times height. The table is a list of size zeros. Set item 0 of table to 1.\nFor every column from 1 to patternsize.\nIf character (column minus 1) of pattern is 42 and item (column minus 1) of table is 1, set item column of table to 1.\n\nFor every row from 1 to textsize.\nFor every column from 1 to patternsize.\nThe index is row times width plus column. The symbol is character (column minus 1) of pattern. If symbol is 42 and item (index minus width) of table is 1, set item index of table to 1. If symbol is 42 and item (index minus 1) of table is 1, set item index of table to 1. If symbol is 63 and item (index minus width minus 1) of table is 1, set item index of table to 1. If symbol is character (row minus 1) of text and item (index minus width minus 1) of table is 1, set item index of table to 1.\n\nThe last is one less than size. If item last of table is 1, report true. Otherwise, report false.\n","expected":"true\n","step_budget":2000000},{"id":45,"slug":"jump-game-ii","title":"Jump Game II","difficulty":"Medium","category":"Array","code":"The jumps is a list of 2, 3, 1, 1, and 4. The last is the last position of jumps. The steps is 0. The start is 0. The currentend is 0. The farthest is 0.\nRepeat while currentend is less than last.\nFor every scan from start to currentend, The reach is scan plus item scan of jumps, if reach is greater than farthest, set farthest to reach. Set start to one more than currentend. Set currentend to farthest. Add 1 to steps.\n\nShow steps.\n","expected":"2\n","step_budget":2000000},{"id":46,"slug":"permutations","title":"Permutations","difficulty":"Medium","category":"Array","code":"Keep a shared nums holding 1, 2, and 3. Keep a shared used as an empty list of whole numbers. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text.\nTo permute from depth (a whole number). If depth is 3, The built is join parts with \"\", Place built into answers, then return.\nFor every position from 0 to 2.\nIf used contains position, skip to the next one. Place position into used. The piece is format whole number item position of nums as text. Place piece into parts. Permute from depth plus 1. Remove the last item from used. Remove the last item from parts.\n\nPermute from 0. For each answer in answers, display answer.\n","expected":"123\n132\n213\n231\n312\n321\n","step_budget":2000000},{"id":47,"slug":"permutations-ii","title":"Permutations II","difficulty":"Medium","category":"Array","code":"Keep a shared nums holding 1, 1, and 2. Sort nums. Keep a shared used as an empty list of whole numbers. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text.\nTo permute from depth (a whole number). If depth is 3, The built is join parts with \"\", Place built into answers, then return.\nFor every position from 0 to 2.\nIf used contains position, skip to the next one. The duplicate is 0. If position is more than 0 and item position of nums is item (position minus 1) of nums, set duplicate to 1. If duplicate is 1 and used contains (position minus 1), set duplicate to 0. If duplicate is 1, skip to the next one. Place position into used. The piece is format whole number item position of nums as text. Place piece into parts. Permute from depth plus 1. Remove the last item from used. Remove the last item from parts.\n\nPermute from 0. For each answer in answers, report answer.\n","expected":"112\n121\n211\n","step_budget":2000000},{"id":48,"slug":"rotate-image","title":"Rotate Image","difficulty":"Medium","category":"Array","code":"The matrix is a list of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The size is 3. The last is size minus 1.\nFor every row from 0 to last.\nFor every column from row to last.\nSwap item (row times size plus column) of matrix and item (column times size plus row) of matrix.\n\nFor every row from 0 to last.\nFor every column from 0 to 1.\nThe mirror is last minus column. Swap item (row times size plus column) of matrix and item (row times size plus mirror) of matrix.\n\nFor each value in matrix, show value.\n","expected":"7\n4\n1\n8\n5\n2\n9\n6\n3\n","step_budget":2000000},{"id":49,"slug":"group-anagrams","title":"Group Anagrams","difficulty":"Medium","category":"Array","code":"The text is \"eat,tea,tan,ate,nat,bat\". The wordslist is split text by \",\". The last is the last position of wordslist. The signatures is an empty list of text.\nFor each word in wordslist.\nThe signature is sort characters of word. Place signature into signatures.\n\nFor every left from 0 to last.\nFor every right from left to last.\nIf item right of signatures comes before item left of signatures, swap item left of signatures and item right of signatures, swap item left of wordslist and item right of wordslist.\n\nThe group is empty text. The groupcount is 0. The current is empty text. The answers is an empty list of text.\nFor every position from 0 to last.\nThe signature is item position of signatures. The word is item position of wordslist. If position is 0, set current to signature, Place word into group, add 1 to groupcount. The same is 1. If signature comes before current, set same to 0. If current comes before signature, set same to 0. If position is more than 0 and same is 1 and groupcount is more than 0, Place \",\" into group, Place word into group, add 1 to groupcount. If position is more than 0 and same is 0, Place group into answers, set group to empty text, set groupcount to 0, set current to signature, Place word into group, add 1 to groupcount.\n\nPlace group into answers. For each answer in answers, display answer.\n","expected":"bat\ntea,ate,eat\nnat,tan\n","step_budget":2000000},{"id":50,"slug":"powx-n","title":"Pow(x, n)","difficulty":"Medium","category":"Math","code":"The result is 1.0. The factor is 2.0. The power is 10.\nRepeat while power is more than 0.\nIf power modulo 2 is 1, set result to result times factor. Set factor to factor times factor. Set power to power divided by 2.\n\nReport result.\n","expected":"1024.0000\n","step_budget":2000000},{"id":51,"slug":"n-queens","title":"N-Queens","difficulty":"Hard","category":"Array","code":"Keep a shared queens as an empty list of whole numbers. 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. Keep a shared piece as empty text. Keep a shared safe of 0.\nTo check square at column (a whole number) for row (a whole number). Set safe to 1.\nFor every prior from 0 to row minus 1.\nThe other is item prior of queens. If other is column, set safe to 0. The difference is column minus other. If difference is less than 0, set difference to 0 minus difference. The distance is row minus prior. If difference is distance, set safe to 0.\n\nTo place from level (a whole number). If level is 4, The built is join parts with \",\", Place built into answers, then return.\nFor every candidate from 0 to 3.\nCheck square at candidate for level. If safe is 1, Place candidate into queens, Set piece to format whole number candidate as text, Place piece into parts, place from level plus 1, remove the last item from queens, remove the last item from parts.\n\nPlace from 0. For each answer in answers, show answer.\n","expected":"1,3,0,2\n2,0,3,1\n","step_budget":2000000},{"id":52,"slug":"n-queens-ii","title":"N-Queens II","difficulty":"Hard","category":"Backtracking","code":"Keep a shared queens as an empty list of whole numbers. Keep a shared safe of 0. Keep a shared total of 0.\nTo check square at column (a whole number) for row (a whole number). Set safe to 1.\nFor every prior from 0 to row minus 1.\nThe other is item prior of queens. If other is column, set safe to 0. The difference is column minus other. If difference is less than 0, set difference to 0 minus difference. The distance is row minus prior. If difference is distance, set safe to 0.\n\nTo place from level (a whole number). If level is 4, add 1 to total, then return.\nFor every candidate from 0 to 3.\nCheck square at candidate for level. If safe is 1, Place candidate into queens, place from level plus 1, remove the last item from queens.\n\nPlace from 0. Display total.\n","expected":"2\n","step_budget":2000000},{"id":53,"slug":"maximum-subarray","title":"Maximum Subarray","difficulty":"Medium","category":"Array","code":"The nums is a list of -2, 1, -3, 4, -1, 2, 1, -5, and 4. The best is item 0 of nums. The current is 0.\nFor every position from 0 to the last position of nums.\nSet current to the larger of current plus item position of nums and item position of nums. Set best to the larger of best and current.\n\nReport best.\n","expected":"6\n","step_budget":2000000},{"id":54,"slug":"spiral-matrix","title":"Spiral Matrix","difficulty":"Medium","category":"Array","code":"The matrix is a list of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The rows is 3. The columns is 3. The size is rows times columns. The visited is a list of size zeros. The spiral is an empty list of whole numbers. The row is 0. The column is 0. The down is 0. The right is 1.\nFor every step from 0 to one less than size.\nPlace item (row times columns plus column) of matrix into spiral. Set item (row times columns plus column) of visited to 1. The nextrow is row plus down. The nextcolumn is column plus right. The blocked is 0. The olddown is 0. If nextrow is less than 0 or nextrow is at least rows or nextcolumn is less than 0 or nextcolumn is at least columns, set blocked to 1. If blocked is 0 and item (nextrow times columns plus nextcolumn) of visited is 1, set blocked to 1. If blocked is 1, set olddown to down. If blocked is 1, set down to right. If blocked is 1, set right to 0 minus olddown. Increase row by down. Increase column by right.\n\nFor each value in spiral, show value.\n","expected":"1\n2\n3\n6\n9\n8\n7\n4\n5\n","step_budget":2000000},{"id":55,"slug":"jump-game","title":"Jump Game","difficulty":"Medium","category":"Array","code":"The jumps is a list of 2, 3, 1, 1, and 4. The farthest is 0. The possible is 1.\nFor every position from 0 to the last position of jumps.\nIf position is more than farthest, set possible to 0. The arrival is position plus item position of jumps. If position is at most farthest, set farthest to the larger of farthest and arrival.\n\nIf possible is 1, display true, otherwise display false.\n","expected":"true\n","step_budget":2000000},{"id":56,"slug":"merge-intervals","title":"Merge Intervals","difficulty":"Medium","category":"Array","code":"The begins is a list of 1, 2, 8, and 15. The finishes is a list of 3, 6, 10, and 18. The last is the last position of begins.\nFor every left from 0 to last.\nFor every right from left to last.\nIf item right of begins is less than item left of begins, swap item left of begins and item right of begins, swap item left of finishes and item right of finishes.\n\nThe outbegins is an empty list of whole numbers. The outfinishes is an empty list of whole numbers.\nFor every position from 0 to last.\nThe start is item position of begins. The finish is item position of finishes. The size is the number of items in outbegins. If size is 0, Place start into outbegins, Place finish into outfinishes. If size is more than 0 and start is at most item (size minus 1) of outfinishes and finish is more than item (size minus 1) of outfinishes, set item (size minus 1) of outfinishes to finish. If size is more than 0 and start is more than item (size minus 1) of outfinishes, Place start into outbegins, Place finish into outfinishes.\n\nThe count is the number of items in outbegins. The final is count minus 1.\nFor every position from 0 to final.\nReport item position of outbegins. Report item position of outfinishes. Report \"---\".\n","expected":"1\n6\n---\n8\n10\n---\n15\n18\n---\n","step_budget":2000000},{"id":57,"slug":"insert-interval","title":"Insert Interval","difficulty":"Medium","category":"Array","code":"The begins is a list of 1 and 6. The finishes is a list of 3 and 9. Place 2 into begins. Place 5 into finishes. The last is the last position of begins.\nFor every left from 0 to last.\nFor every right from left to last.\nIf item right of begins is less than item left of begins, swap item left of begins and item right of begins, swap item left of finishes and item right of finishes.\n\nThe outbegins is an empty list of whole numbers. The outfinishes is an empty list of whole numbers.\nFor every position from 0 to last.\nThe start is item position of begins. The finish is item position of finishes. The size is the number of items in outbegins. If size is 0, Place start into outbegins, Place finish into outfinishes. If size is more than 0 and start is at most item (size minus 1) of outfinishes and finish is more than item (size minus 1) of outfinishes, set item (size minus 1) of outfinishes to finish. If size is more than 0 and start is more than item (size minus 1) of outfinishes, Place start into outbegins, Place finish into outfinishes.\n\nThe count is the number of items in outbegins. The final is count minus 1.\nFor every position from 0 to final.\nShow item position of outbegins. Show item position of outfinishes. Show \"---\".\n","expected":"1\n5\n---\n6\n9\n---\n","step_budget":2000000},{"id":58,"slug":"length-of-last-word","title":"Length of Last Word","difficulty":"Easy","category":"String","code":"The word is \"   fly me   to   the moon  \". The final is the last position of word. The position is final. The letters is 0.\nRepeat while position is at least 0 and character position of word is 32.\nSet position to one less than position.\n\nRepeat while position is at least 0 and character position of word isn't equal to 32.\nAdd 1 to letters. Set position to one less than position.\n\nDisplay letters.\n","expected":"4\n","step_budget":2000000},{"id":59,"slug":"spiral-matrix-ii","title":"Spiral Matrix II","difficulty":"Medium","category":"Array","code":"The size is 3. The matrix is a list of 9 zeros. The visited is a list of 9 zeros. The row is 0. The column is 0. The down is 0. The right is 1. The counter is 1.\nFor every step from 0 to 8.\nSet item (row times size plus column) of matrix to counter. Set item (row times size plus column) of visited to 1. Add 1 to counter. The nextrow is row plus down. The nextcolumn is column plus right. The blocked is 0. The olddown is 0. If nextrow is less than 0 or nextrow is at least size or nextcolumn is less than 0 or nextcolumn is at least size, set blocked to 1. If blocked is 0 and item (nextrow times size plus nextcolumn) of visited is 1, set blocked to 1. If blocked is 1, set olddown to down. If blocked is 1, set down to right. If blocked is 1, set right to 0 minus olddown. Increase row by down. Increase column by right.\n\nFor each value in matrix, report value.\n","expected":"1\n2\n3\n8\n9\n4\n7\n6\n5\n","step_budget":2000000},{"id":60,"slug":"permutation-sequence","title":"Permutation Sequence","difficulty":"Hard","category":"Math","code":"The size is 3. The rank is 3. Decrease rank by 1. The available is an empty list of whole numbers.\nFor every digit from 1 to size.\nPlace digit into available.\n\nThe block is 1.\nFor every step from 2 to size minus 1.\nSet block to block times step.\n\nThe result is empty text. The last is size minus 1.\nFor every position from 0 to last.\nThe index is rank divided by block. Set rank to rank modulo block. The chosen is item index of available. Remove item index of available. Place the character for chosen into result. If position is less than last, set block to block divided by (last minus position).\n\nShow result.\n","expected":"213\n","step_budget":2000000},{"id":61,"slug":"rotate-list","title":"Rotate List","difficulty":"Medium","category":"Two Pointers","code":"The values is a list of 1, 2, 3, 4, and 5. The last is the last position of values. The size is last plus 1. The target is 2. The offset is target modulo size. The result is an empty list of whole numbers.\nFor every position from 0 to last.\nThe source is position plus size minus offset. If source is at least size, set source to source minus size. Place item source of values into result.\n\nFor each value in result, display value.\n","expected":"4\n5\n1\n2\n3\n","step_budget":2000000},{"id":62,"slug":"unique-paths","title":"Unique Paths","difficulty":"Medium","category":"Math","code":"The rows is 3. The columns is 7. The size is the product of rows and columns. The table is a list of size zeros.\nFor every position from 0 to one less than size.\nThe row is position divided by columns. The column is position modulo columns. If row is 0 or column is 0, set item position of table to 1. If row is more than 0 and column is more than 0, set item position of table to item (position minus columns) of table plus item (position minus 1) of table.\n\nThe last is one less than size. Report item last of table.\n","expected":"28\n","step_budget":2000000},{"id":63,"slug":"unique-paths-ii","title":"Unique Paths II","difficulty":"Medium","category":"Array","code":"The grid is a list of 0, 0, 0, 0, 1, 0, 0, 0, and 0. The columns is 3. The size is the number of items in grid. The table is a list of size zeros.\nFor every position from 0 to one less than size.\nThe row is position divided by columns. The column is position modulo columns. If item position of grid is 1, set item position of table to 0. If row is 0 and column is 0 and item position of grid is 0, set item position of table to 1. If row is 0 and column is more than 0 and item position of grid is 0, set item position of table to item (position minus 1) of table. If row is more than 0 and column is 0 and item position of grid is 0, set item position of table to item (position minus columns) of table. If row is more than 0 and column is more than 0 and item position of grid is 0, set item position of table to item (position minus 1) of table plus item (position minus columns) of table.\n\nThe last is one less than size. Show item last of table.\n","expected":"2\n","step_budget":2000000},{"id":64,"slug":"minimum-path-sum","title":"Minimum Path Sum","difficulty":"Medium","category":"Array","code":"The grid is a list of 1, 3, 1, 1, 5, 1, 4, 2, and 1. The columns is 3. The size is the number of items in grid. The table is a list of size zeros. Set item 0 of table to item 0 of grid.\nFor every position from 1 to one less than size.\nThe row is position divided by columns. The column is position modulo columns. If row is 0, set item position of table to item (position minus 1) of table plus item position of grid. If row is more than 0 and column is 0, set item position of table to item (position minus columns) of table plus item position of grid. If row is more than 0 and column is more than 0, The above is item (position minus columns) of table, The previous is item (position minus 1) of table, The best path is the smaller of above and previous, set item position of table to best path plus item position of grid.\n\nThe last is one less than size. Display item last of table.\n","expected":"7\n","step_budget":2000000},{"id":65,"slug":"valid-number","title":"Valid Number","difficulty":"Hard","category":"String","code":"The text is \"2e10\". The last is the last position of text. The position is 0. The digits is 0. The expcount is 0. The exponentseen is 0. The valid is 1.\nRepeat while position is at most last.\nIf character position of text is not 32, break. Add 1 to position.\n\nIf position is at most last and (character position of text is 43 or character position of text is 45), add 1 to position.\nRepeat while position is at most last and character position of text is between \"0\" and \"9\".\nAdd 1 to digits. Add 1 to position.\n\nIf position is at most last and character position of text is 46.\nAdd 1 to position.\nRepeat while position is at most last and character position of text is between \"0\" and \"9\".\nAdd 1 to digits. Add 1 to position.\n\nIf position is at most last and (character position of text is 101 or character position of text is 69).\nSet exponentseen to 1. Add 1 to position. If position is at most last and (character position of text is 43 or character position of text is 45), add 1 to position.\nRepeat while position is at most last and character position of text is between \"0\" and \"9\".\nAdd 1 to expcount. Add 1 to position.\n\nIf exponentseen is 1 and expcount is 0, set valid to 0.\nRepeat while position is at most last.\nIf character position of text is not 32, set valid to 0, break. Add 1 to position.\n\nIf digits is 0, set valid to 0. If valid is 1, report true. Otherwise, report false.\n","expected":"true\n","step_budget":2000000},{"id":66,"slug":"plus-one","title":"Plus One","difficulty":"Easy","category":"Array","code":"The digits is a list of 1, 2, and 3. The position is the last position of digits. The carry is 1.\nRepeat while position is at least 0 and carry is 1.\nThe sum is item position of digits plus carry. Set item position of digits to sum modulo 10. Set carry to sum divided by 10. Set position to one less than position.\n\nFor each digit in digits, show digit.\n","expected":"1\n2\n4\n","step_budget":2000000},{"id":67,"slug":"add-binary","title":"Add Binary","difficulty":"Easy","category":"String","code":"The source is \"11\". The target is \"1\". The lastsource is the last position of source. The lasttarget is the last position of target. The position is lastsource. The mark is lasttarget. The carry is 0. The reversedresult is empty text.\nRepeat while position is at least 0 or mark is at least 0 or carry is 1.\nThe sum is carry. The digit is 0. If position is at least 0, set digit to the digit value of character position of source. If position is at least 0, add digit to sum. If position is at least 0, set position to one less than position. If mark is at least 0, set digit to the digit value of character mark of target. If mark is at least 0, add digit to sum. If mark is at least 0, set mark to one less than mark. The bit is the character for sum modulo 2. Place bit into reversedresult. Set carry to sum divided by 2.\n\nThe result is empty text. The reversedlast is the last position of reversedresult. For every step from 0 to reversedlast, The number is reversedlast minus step, Place character number of reversedresult into result. Display result.\n","expected":"100\n","step_budget":2000000},{"id":68,"slug":"text-justification","title":"Text Justification","difficulty":"Hard","category":"Array","code":"The source is \"This,is,an,example,of,text,justification.\". The pieces is split source by \",\". Keep a shared words as an empty list of text.\nFor each piece in pieces.\nPlace piece into words.\n\nKeep a shared count of 7. Keep a shared width of 16. Keep a shared finish of 0. Keep a shared usedwidth of 0. Keep a shared padding as empty text. Keep a shared piece as empty text. Keep a shared padpiece as empty text. Set padding to 32 spaces.\n\nTo search from position (a whole number) with occupied (a whole number). If position is count, set finish to position, return. The word is item position of words. The wordlast is the last position of word. The nextusedwidth is occupied plus 2 plus wordlast. The previousused is occupied. Set usedwidth to nextusedwidth. If nextusedwidth is at most width, search from position plus 1 with nextusedwidth, return. Set usedwidth to previousused. Set finish to position.\n\nTo build line from start (a whole number). Set finish to 0. The firstword is item start of words. The firstlast is the last position of firstword. Set usedwidth to firstlast plus 1. Search from start plus 1 with usedwidth. The linewords is finish minus start. The gaps is linewords minus 1. The base is 0. The extra is 0. If finish is less than count and gaps is more than 0, set base to (width minus usedwidth plus gaps) divided by gaps, set extra to (width minus usedwidth plus gaps) modulo gaps. The line is empty text.\nFor every index from start to finish minus 1.\nThe word is item index of words. Place word into line. The gap is index minus start. The amount is base. If gap is less than extra, add 1 to amount. Set piece to the slice of padding from 0 to amount. If index is less than finish minus 1 and finish is count, Place \" \" into line. If index is less than finish minus 1 and finish is less than count, Place piece into line. If index is finish minus 1 and finish is count, set padpiece to the slice of padding from 0 to width minus usedwidth plus gaps, Place padpiece into line, report line. If index is finish minus 1 and finish is less than count, report line, build line from finish.\n\nBuild line from 0.\n","expected":"This    is    an\nexample  of text\njustification.  \n","step_budget":2000000},{"id":69,"slug":"sqrtx","title":"Sqrt(x)","difficulty":"Easy","category":"Math","code":"The target is 8. The low is 0. The high is target. The answer is 0.\nRepeat while low is at most high.\nThe middle is the midpoint of low and high. If middle times middle is at most target, set answer to middle, set low to one more than middle, otherwise set high to one less than middle.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":70,"slug":"climbing-stairs","title":"Climbing Stairs","difficulty":"Easy","category":"Math","code":"The target is 5. The size is target plus 1. The ways is a list of size zeros. Set item 0 of ways to 1.\nFor every position from 1 to target.\nIf position is 1, set item position of ways to 1. If position is more than 1, set item position of ways to item (position minus 1) of ways plus item (position minus 2) of ways.\n\nDisplay item target of ways.\n","expected":"8\n","step_budget":2000000},{"id":71,"slug":"simplify-path","title":"Simplify Path","difficulty":"Medium","category":"String","code":"The path is empty text. Place \"/home//foo/\" into path. The parts is split path by \"/\". The stack is an empty list of text.\nFor each part in parts.\nIf part is \"\", skip to the next one. If part is \".\", skip to the next one. The size is the number of items in stack. The parentstep is 0. If part is \"..\", set parentstep to 1. If parentstep is 1 and size is more than 0, remove the last item from stack. If parentstep is 1 and size is 0, skip to the next one. The keep is 1. If part is \"\", set keep to 0. If part is \".\", set keep to 0. If parentstep is 1, set keep to 0. If keep is 1, Place part into stack.\n\nThe joined is join stack with \"/\". The result is empty text. Place \"/\" into result. Place joined into result. Report result.\n","expected":"/home/foo\n","step_budget":2000000},{"id":72,"slug":"edit-distance","title":"Edit Distance","difficulty":"Medium","category":"String","code":"The first is \"horse\". The second is \"ros\". The lastfirst is the last position of first. The lastsecond is the last position of second. The rows is lastfirst plus 1. The columns is lastsecond plus 1. The width is columns plus 1. The height is rows plus 1. The size is width times height. The table is a list of size zeros.\nFor every column from 0 to lastsecond.\nSet item column of table to column.\n\nFor every row from 1 to rows.\nSet item (row times width) of table to row.\n\nFor every row from 1 to rows.\nFor every column from 1 to columns.\nThe index is row times width plus column. If character (row minus 1) of first is character (column minus 1) of second, set item index of table to item (index minus width minus 1) of table. Otherwise, The removal is item (index minus width) of table, The insertion is item (index minus 1) of table, The replacement is item (index minus width minus 1) of table, The best is the smaller of removal and insertion, The final best is the smaller of best and replacement, set item index of table to final best plus 1.\n\nThe last is one less than size. Show item last of table.\n","expected":"3\n","step_budget":2000000},{"id":73,"slug":"set-matrix-zeroes","title":"Set Matrix Zeroes","difficulty":"Medium","category":"Array","code":"The matrix is a list of 1, 1, 1, 1, 0, 1, 1, 1, and 1. The rows is 3. The columns is 3. The lastrow is rows minus 1. The lastcolumn is columns minus 1. The rowmarks is an empty list of whole numbers. The colmarks is an empty list of whole numbers.\nFor every row from 0 to lastrow.\nFor every column from 0 to lastcolumn.\nIf item (row times columns plus column) of matrix is 0, Place row into rowmarks. If item (row times columns plus column) of matrix is 0, Place column into colmarks.\n\nFor each row in rowmarks.\nFor every column from 0 to lastcolumn.\nSet item (row times columns plus column) of matrix to 0.\n\nFor each column in colmarks.\nFor every row from 0 to lastrow.\nSet item (row times columns plus column) of matrix to 0.\n\nFor each value in matrix, display value.\n","expected":"1\n0\n1\n0\n0\n0\n1\n0\n1\n","step_budget":2000000},{"id":74,"slug":"search-a-2d-matrix","title":"Search a 2D Matrix","difficulty":"Medium","category":"Array","code":"The matrix is a list of 1, 3, 5, 7, 10, 11, 16, 20, 23, 30, 34, 50. The target is 3. The found is -1.\nFor every position from 0 to the last position of matrix.\nIf item position of matrix is target, set found to position, then stop.\n\nIf found is not equal to -1, report true, otherwise report false.\n","expected":"true\n","step_budget":2000000},{"id":75,"slug":"sort-colors","title":"Sort Colors","difficulty":"Medium","category":"Array","code":"The colors is a list of 2, 0, 2, 1, 1, and 0. Sort colors. For each color in colors, show color.\n","expected":"0\n0\n1\n1\n2\n2\n","step_budget":2000000},{"id":76,"slug":"minimum-window-substring","title":"Minimum Window Substring","difficulty":"Hard","category":"String","code":"The source is \"ADOBECODEBANC\". The target is \"ABC\". The sourcelast is the last position of source. The targetlast is the last position of target. The need is an empty map.\nFor every position from 0 to targetlast.\nThe symbol is character position of target. Add 1 to entry symbol of need.\n\nThe window is an empty map. The required is the number of entries in need. The formed is 0. The left is 0. The beststart is 0. The bestlength is 1000000.\nFor every right from 0 to sourcelast.\nThe symbol is character right of source. Add 1 to entry symbol of window. If need has entry symbol and entry symbol of window is entry symbol of need, add 1 to formed.\nRepeat while formed is required.\nThe width is right minus left plus 1. If width is less than bestlength, set beststart to left, set bestlength to width. The mark is character left of source. Subtract 1 from entry mark of window. If need has entry mark and entry mark of window is less than entry mark of need, subtract 1 from formed. Add 1 to left.\n\nThe finish is beststart plus bestlength. The answer is the slice of source from beststart to finish. Display answer.\n","expected":"BANC\n","step_budget":2000000},{"id":77,"slug":"combinations","title":"Combinations","difficulty":"Medium","category":"Backtracking","code":"Keep a shared size of 4. Keep a shared choose of 2. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text.\nTo combine from index (a whole number) with depth (a whole number). If depth is choose, The built is join parts with \",\", Place built into answers, then return. If index is more than size, return.\nFor every value from index to size.\nThe piece is format whole number value as text. Place piece into parts. Combine from value plus 1 with depth plus 1. Remove the last item from parts.\n\nCombine from 1 with 0. For each answer in answers, report answer.\n","expected":"1,2\n1,3\n1,4\n2,3\n2,4\n3,4\n","step_budget":2000000},{"id":78,"slug":"subsets","title":"Subsets","difficulty":"Medium","category":"Array","code":"Keep a shared nums holding 1, 2, and 3. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared marker as empty text. Keep a shared built as empty text. Keep a shared piece as empty text. Keep a shared partcount of 0. Place \"()\" into marker.\nTo collect from index (a whole number). Set built to join parts with \",\". If partcount is 0, set built to marker. Place built into answers.\nFor every position from index to 2.\nSet piece to format whole number item position of nums as text. Place piece into parts. Add 1 to partcount. Collect from position plus 1. Remove the last item from parts. Subtract 1 from partcount.\n\nCollect from 0. For each answer in answers, show answer.\n","expected":"()\n1\n1,2\n1,2,3\n1,3\n2\n2,3\n3\n","step_budget":2000000},{"id":79,"slug":"word-search","title":"Word Search","difficulty":"Medium","category":"Array","code":"Keep a shared board holding 65, 66, 67, 69, 83, 70, 67, 83, 65, 68, 69, and 69. Keep a shared word as empty text. Place \"ABCCED\" into word. Keep a shared visited as an empty list of whole numbers.\nFor every cell from 0 to 11.\nPlace 0 into visited.\n\nKeep a shared found of 0.\nTo search from row (a whole number) at column (a whole number) with index (a whole number). If found is 1, return. If row is less than 0 or row is more than 2 or column is less than 0 or column is more than 3, return. If item (row times 4 plus column) of visited is 1, return. If item (row times 4 plus column) of board is not character index of word, return. If index is 3, set found to 1, return. Set item (row times 4 plus column) of visited to 1. If found is 0, search from row plus 1 at column with index plus 1. If found is 0, search from row minus 1 at column with index plus 1. If found is 0, search from row at column plus 1 with index plus 1. If found is 0, search from row at column minus 1 with index plus 1. Set item (row times 4 plus column) of visited to 0.\n\nSearch from 0 at 0 with 0. If found is 1, display true. Otherwise, display false.\n","expected":"true\n","step_budget":2000000},{"id":80,"slug":"remove-duplicates-from-sorted-array-ii","title":"Remove Duplicates from Sorted Array II","difficulty":"Medium","category":"Array","code":"The nums is a list of 1, 1, 1, 2, 2, and 3. The result is an empty list of whole numbers.\nFor each number in nums.\nThe occurrences is 0. For every existing in result, if existing is number, add 1 to occurrences. If occurrences is less than 2, Place number into result.\n\nReport the number of items in result. For each number in result, report number.\n","expected":"5\n1\n1\n2\n2\n3\n","step_budget":2000000},{"id":81,"slug":"search-in-rotated-sorted-array-ii","title":"Search in Rotated Sorted Array II","difficulty":"Medium","category":"Array","code":"The nums is a list of 2, 5, 6, 0, 0, 1, and 2. The target is 0. The found is -1.\nFor every position from 0 to the last position of nums.\nIf item position of nums is target, set found to position, then stop.\n\nIf found is not equal to -1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":82,"slug":"remove-duplicates-from-sorted-list-ii","title":"Remove Duplicates from Sorted List II","difficulty":"Medium","category":"Two Pointers","code":"The values is a list of 1, 2, 3, 3, 4, 4, and 5. The counts is an empty map.\nFor each value in values.\nAdd 1 to entry value of counts.\n\nThe result is an empty list of whole numbers.\nFor each value in values.\nIf entry value of counts is 1, Place value into result.\n\nFor each value in result, display value.\n","expected":"1\n2\n5\n","step_budget":2000000},{"id":83,"slug":"remove-duplicates-from-sorted-list","title":"Remove Duplicates from Sorted List","difficulty":"Easy","category":"Linked List","code":"The values is a list of 1, 1, 2. The result is an empty list of whole numbers. The resultcount is 0.\nFor each value in values.\nIf resultcount is 0 or item (resultcount minus 1) of result is not value, Place value into result, add 1 to resultcount.\n\nFor each value in result, report value.\n","expected":"1\n2\n","step_budget":2000000},{"id":84,"slug":"largest-rectangle-in-histogram","title":"Largest Rectangle in Histogram","difficulty":"Hard","category":"Array","code":"The heights is a list of 2, 1, 5, 6, 2, and 3. The last is the last position of heights. The best is 0.\nFor every left from 0 to last.\nThe minimum is item left of heights.\nFor every right from left to last.\nIf item right of heights is less than minimum, set minimum to item right of heights. The area is minimum times (right minus left plus 1). If area is more than best, set best to area.\n\nShow best.\n","expected":"10\n","step_budget":2000000},{"id":85,"slug":"maximal-rectangle","title":"Maximal Rectangle","difficulty":"Hard","category":"Array","code":"The matrix is a list of 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, and 0. The rows is 4. The columns is 5. The width is columns plus 1. The height is rows plus 1. The size is width times height. The prefix is a list of size zeros.\nFor every row from 1 to rows.\nFor every column from 1 to columns.\nThe index is row times width plus column. The cellrow is row minus 1. The cellindex is cellrow times columns plus column minus 1. Set item index of prefix to item (index minus width) of prefix plus item (index minus 1) of prefix minus item (index minus width minus 1) of prefix plus item cellindex of matrix.\n\nThe best is 0.\nFor every top from 0 to one less than rows.\nFor every bottom from top to one less than rows.\nFor every left from 0 to one less than columns.\nFor every right from left to one less than columns.\nThe area is (bottom minus top plus 1) times (right minus left plus 1). The ones is item ((bottom plus 1) times width plus right plus 1) of prefix minus item (top times width plus right plus 1) of prefix minus item ((bottom plus 1) times width plus left) of prefix plus item (top times width plus left) of prefix. If ones is area and area is more than best, set best to area.\n\nDisplay best.\n","expected":"6\n","step_budget":2000000},{"id":86,"slug":"partition-list","title":"Partition List","difficulty":"Medium","category":"Two Pointers","code":"The values is a list of 1, 4, 3, 2, 5, and 2. The pivot is 3. The lower is an empty list of whole numbers. The upper is an empty list of whole numbers.\nFor each value in values.\nIf value is less than pivot, Place value into lower. If value is at least pivot, Place value into upper.\n\nFor each value in upper.\nPlace value into lower.\n\nFor each value in lower, report value.\n","expected":"1\n2\n2\n4\n3\n5\n","step_budget":2000000},{"id":87,"slug":"scramble-string","title":"Scramble String","difficulty":"Hard","category":"String","code":"The firsttext is \"great\". The secondtext is \"rgeat\". The size is 5. The width is 6. The table is a list of 150 zeros.\nFor every first from 0 to 4.\nFor every second from 0 to 4.\nIf character first of firsttext is character second of secondtext, set item ((first times 5 plus second) times 6 plus 1) of table to 1.\n\nFor every length from 2 to 5.\nFor every first from 0 to (5 minus length).\nFor every second from 0 to (5 minus length).\nFor every split from 1 to length minus 1.\nThe base is (first times 5 plus second) times 6. The splitindex is base plus split. The noother is (first plus split) times 5 plus second plus split. The nootherindex is noother times 6 plus length minus split. The swapother is first times 5 plus second plus length minus split. The swapotherindex is swapother times 6 plus split. The swapbase is (first plus split) times 5 plus second. The swapbaseindex is swapbase times 6 plus length minus split. The noswap is 0. If item splitindex of table is 1 and item nootherindex of table is 1, set noswap to 1. The withswap is 0. If item swapotherindex of table is 1 and item swapbaseindex of table is 1, set withswap to 1. The fullindex is base plus length. If noswap is 1 or withswap is 1, set item fullindex of table to 1.\n\nIf item 5 of table is 1, show true. Otherwise, show false.\n","expected":"true\n","step_budget":2000000},{"id":88,"slug":"merge-sorted-array","title":"Merge Sorted Array","difficulty":"Easy","category":"Array","code":"The first is a list of 1, 2, and 3. The second is a list of 2, 5, and 6. The combined is an empty list of whole numbers. For each number in first, Place number into combined. For each number in second, Place number into combined. Sort combined. For each number in combined, display number.\n","expected":"1\n2\n2\n3\n5\n6\n","step_budget":2000000},{"id":89,"slug":"gray-code","title":"Gray Code","difficulty":"Medium","category":"Math","code":"The count is 4. The codes is an empty list of whole numbers.\nFor every value from 0 to one less than count.\nThe shifted is shift value right by 1. The code is exclusive or of value and shifted. Place code into codes.\n\nFor each code in codes, report code.\n","expected":"0\n1\n3\n2\n","step_budget":2000000},{"id":90,"slug":"subsets-ii","title":"Subsets II","difficulty":"Medium","category":"Array","code":"Keep a shared nums holding 1, 2, and 2. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared marker as empty text. Keep a shared built as empty text. Keep a shared piece as empty text. Keep a shared partcount of 0. Place \"()\" into marker.\nTo collect from index (a whole number). Set built to join parts with \",\". If partcount is 0, set built to marker. Place built into answers.\nFor every position from index to 2.\nIf position is more than index and item position of nums is item (position minus 1) of nums, skip to the next one. Set piece to format whole number item position of nums as text. Place piece into parts. Add 1 to partcount. Collect from position plus 1. Remove the last item from parts. Subtract 1 from partcount.\n\nCollect from 0. For each answer in answers, show answer.\n","expected":"()\n1\n1,2\n1,2,2\n2\n2,2\n","step_budget":2000000},{"id":91,"slug":"decode-ways","title":"Decode Ways","difficulty":"Medium","category":"String","code":"The word is \"226\". The size is the number of characters in word. The ways is a list of size plus 1 zeros. Set item 0 of ways to 1.\nFor every position from 1 to size.\nThe previous is one less than position. The firstdigit is the digit value of character previous of word. If firstdigit is more than 0, set item position of ways to item previous of ways. The seconddigit is 0. If position is more than 1, set seconddigit to the digit value of character (position minus 2) of word. The pair is seconddigit times 10 plus firstdigit. If position is more than 1 and pair is at least 10 and pair is at most 26, set item position of ways to item position of ways plus item (position minus 2) of ways.\n\nDisplay item size of ways.\n","expected":"3\n","step_budget":2000000},{"id":92,"slug":"reverse-linked-list-ii","title":"Reverse Linked List II","difficulty":"Medium","category":"Linked List","code":"The values is a list of 1, 2, 3, 4, and 5. The leftedge is 2. The rightedge is 4. The left is leftedge minus 1. The right is rightedge minus 1. Repeat while left is less than right, swap item left of values and item right of values, add 1 to left, subtract 1 from right.\n\nFor each value in values, report value.\n","expected":"1\n4\n3\n2\n5\n","step_budget":2000000},{"id":93,"slug":"restore-ip-addresses","title":"Restore IP Addresses","difficulty":"Medium","category":"String","code":"Keep a shared text as empty text. Place \"25525511135\" into text. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared piece as empty text. Keep a shared partcount of 0. Keep a shared text length as 0. Set text length to 11.\nTo save piece from start (a whole number) to finish (a whole number). Set piece to the slice of text from start to finish. Place piece into parts. Add 1 to partcount. Restore from finish. Remove the last item from parts. Subtract 1 from partcount.\n\nTo restore from position (a whole number). If partcount is 4 and position is text length, The built is join parts with \".\", Place built into answers, then return. If partcount is 4, return. If position is text length, return. The first is the digit value of character position of text. The second is 0. If position plus 1 is at most text length, set second to the digit value of character (position plus 1) of text. The third is 0. If position plus 2 is at most text length, set third to the digit value of character (position plus 2) of text. If position is less than text length, save piece from position to position plus 1. If position plus 1 is at most text length and first is not 0, save piece from position to position plus 2. If position plus 2 is at most text length and first is not 0 and first times 100 plus second times 10 plus third is at most 255, save piece from position to position plus 3.\n\nRestore from 0. For each answer in answers, show answer.\n","expected":"255.255.11.135\n255.255.111.35\n","step_budget":2000000},{"id":94,"slug":"binary-tree-inorder-traversal","title":"Binary Tree Inorder Traversal","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, and 3. Keep a shared lefts holding -1, 2, and -1. Keep a shared rights holding 1, -1, and -1. Keep a shared order as an empty list of whole numbers.\nTo gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Place node into order. Gather from item node of rights.\n\nGather from 0. For each node in order, display item node of values.\n","expected":"1\n3\n2\n","step_budget":2000000},{"id":95,"slug":"unique-binary-search-trees-ii","title":"Unique Binary Search Trees II","difficulty":"Medium","category":"Dynamic Programming","code":"Keep a shared used as an empty list of whole numbers. Keep a shared prefix as empty text. Keep a shared answers as an empty list of text. Keep a shared copy as empty text.\nTo check permutation. The root is the digit value of character 0 of prefix. The second is the digit value of character 1 of prefix. The third is the digit value of character 2 of prefix. The okay is 1. If second is more than root and third is less than root, set okay to 0. If okay is 1, Set copy to a copy of prefix, Place copy into answers.\n\nTo permute from depth (a whole number). If depth is 3, check permutation, then return.\nFor every value from 1 to 3.\nIf used contains value, skip to the next one. Place value into used. Place the character for value into prefix. Permute from depth plus 1. Remove the last item from used. Remove last character from prefix.\n\nPermute from 0. Report the length of answers. For each answer in answers, report answer.\n","expected":"5\n123\n132\n213\n312\n321\n","step_budget":2000000},{"id":96,"slug":"unique-binary-search-trees","title":"Unique Binary Search Trees","difficulty":"Medium","category":"Math","code":"The target is 5. The size is target plus 1. The ways is a list of size zeros. Set item 0 of ways to 1.\nFor every count from 1 to target.\nFor every split from 0 to one less than count.\nThe before is item split of ways. The afterposition is count minus 1 minus split. The after is item afterposition of ways. Increase item count of ways by before times after.\n\nShow item target of ways.\n","expected":"42\n","step_budget":2000000},{"id":97,"slug":"interleaving-string","title":"Interleaving String","difficulty":"Medium","category":"String","code":"The first is \"aabcc\". The second is \"dbbca\". The third is \"aadbbcbcac\". The firstsize is the number of characters in first. The secondsize is the number of characters in second. The width is secondsize plus 1. The height is firstsize plus 1. The size is width times height. The table is a list of size zeros. Set item 0 of table to 1.\nFor every row from 1 to firstsize.\nIf character (row minus 1) of first is character (row minus 1) of third and item ((row minus 1) times width) of table is 1, set item (row times width) of table to 1.\n\nFor every column from 1 to secondsize.\nIf character (column minus 1) of second is character (column minus 1) of third and item (column minus 1) of table is 1, set item column of table to 1.\n\nFor every row from 1 to firstsize.\nFor every column from 1 to secondsize.\nThe index is row times width plus column. The spot is row plus column minus 1. If character (row minus 1) of first is character spot of third and item (index minus width) of table is 1, set item index of table to 1. If character (column minus 1) of second is character spot of third and item (index minus 1) of table is 1, set item index of table to 1.\n\nThe last is one less than size. If item last of table is 1, display true. Otherwise, display false.\n","expected":"true\n","step_budget":2000000},{"id":98,"slug":"validate-binary-search-tree","title":"Validate Binary Search Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 2, 1, and 3. Keep a shared lefts holding 1, -1, and -1. Keep a shared rights holding 2, -1, and -1. Keep a shared order as an empty list of whole numbers. Keep a shared order count as 0.\nTo gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Place node into order. Add 1 to order count. Gather from item node of rights.\n\nGather from 0. The valid is 1. The last is order count minus 1.\nFor every position from 1 to last.\nThe before is item (position minus 1) of order. The current is item position of order. If item before of values is at least item current of values, set valid to 0.\n\nIf valid is 1, report true. Otherwise, report false.\n","expected":"true\n","step_budget":2000000},{"id":99,"slug":"recover-binary-search-tree","title":"Recover Binary Search Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 3, 1, 4, and 2. Keep a shared lefts holding 1, -1, 3, and -1. Keep a shared rights holding 2, -1, -1, and -1. Keep a shared order as an empty list of whole numbers. Keep a shared order count as 0.\nTo gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Place node into order. Add 1 to order count. Gather from item node of rights.\n\nGather from 0. The firstbad is -1. The secondbad is -1. The last is order count minus 1.\nFor every position from 1 to last.\nThe before is item (position minus 1) of order. The current is item position of order. If item before of values is more than item current of values and firstbad is -1, set firstbad to before. If item before of values is more than item current of values, set secondbad to current.\n\nSwap item firstbad of values and item secondbad of values. For each node in order, show item node of values.\n","expected":"1\n2\n3\n4\n","step_budget":2000000},{"id":100,"slug":"same-tree","title":"Same Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared valuesone holding 1, 2, and 3. Keep a shared leftone holding 1, -1, and -1. Keep a shared rightone holding 2, -1, and -1. Keep a shared valuestwo holding 1, 2, and 3. Keep a shared lefttwo holding 1, -1, and -1. Keep a shared righttwo holding 2, -1, and -1. Keep a shared same of 1.\nTo compare at first (a whole number) with second (a whole number). If same is 0, return. If first is -1 and second is -1, return. If first is -1, set same to 0, return. If second is -1, set same to 0, return. If item first of valuesone is not item second of valuestwo, set same to 0, return. Compare at item first of leftone with item second of lefttwo. Compare at item first of rightone with item second of righttwo.\n\nCompare at 0 with 0. If same is 1, display true. Otherwise, display false.\n","expected":"true\n","step_budget":2000000},{"id":101,"slug":"symmetric-tree","title":"Symmetric Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 2, 3, 4, 4, and 3. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1. Keep a shared same of 1.\nTo mirror from first (a whole number) with second (a whole number). If same is 0, return. If first is -1 and second is -1, return. If first is -1, set same to 0, return. If second is -1, set same to 0, return. If item first of values is not item second of values, set same to 0, return. Mirror from item first of lefts with item second of rights. Mirror from item first of rights with item second of lefts.\n\nMirror from 1 with 2. If same is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":102,"slug":"binary-tree-level-order-traversal","title":"Binary Tree Level Order Traversal","difficulty":"Medium","category":"Breadth-First Search","code":"Keep a shared values holding 3, 9, 20, 15, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1.\n\nThe queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The remaining is 1. The nextcount is 0. The line is empty text. The rows is an empty list of text.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The piece is format whole number item node of values as text. If the length of line is more than 0, Place \",\" into line. Place piece into line. If item node of lefts is at least 0, Place item node of lefts into queue, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. If remaining is 0, Place line into rows, set line to empty text, set remaining to nextcount, set nextcount to 0.\n\nFor each row in rows, show row.\n","expected":"3\n9,20\n15,7\n","step_budget":2000000},{"id":103,"slug":"binary-tree-zigzag-level-order-traversal","title":"Binary Tree Zigzag Level Order Traversal","difficulty":"Medium","category":"Breadth-First Search","code":"Keep a shared values holding 3, 9, 20, 15, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1. Keep a shared rows as an empty list of text. Keep a shared rung as an empty list of text. Keep a shared line as empty text. Keep a shared depth of 0. Keep a shared backward of 0. Keep a shared rungcount of 0.\nTo stitch from spot (a whole number) with last (a whole number). If spot is more than last, return. The source is spot. If backward is 1, set source to last minus spot. If the length of line is more than 0, Place \",\" into line. Place item source of rung into line. Stitch from spot plus 1 with last.\n\nTo finish level. Set line to empty text. Set backward to 0. If depth modulo 2 is 1, set backward to 1. Stitch from 0 with rungcount minus 1. Place line into rows. Add 1 to depth.\n\nFor every filler from 0 to 19, Place \"\" into rung.\n\nThe queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The remaining is 1. The nextcount is 0.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The piece is format whole number item node of values as text. Set item rungcount of rung to piece. Add 1 to rungcount. If item node of lefts is at least 0, Place item node of lefts into queue, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. If remaining is 0, finish level, set rungcount to 0, set remaining to nextcount, set nextcount to 0.\n\nFor each item in rows, show item.\n","expected":"3\n20,9\n15,7\n","step_budget":2000000},{"id":104,"slug":"maximum-depth-of-binary-tree","title":"Maximum Depth of Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 3, 9, 20, 15, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1. Keep a shared deepest of 0.\nTo measure from node (a whole number) with depth (a whole number). If node is less than 0, return. If depth is more than deepest, set deepest to depth. Measure from item node of lefts with depth plus 1. Measure from item node of rights with depth plus 1.\n\nMeasure from 0 with 1. Show deepest.\n","expected":"3\n","step_budget":2000000},{"id":105,"slug":"construct-binary-tree-from-preorder-and-inorder-traversal","title":"Construct Binary Tree from Preorder and Inorder Traversal","difficulty":"Medium","category":"Array","code":"Keep a shared preorder holding 3, 9, 20, 15, and 7. Keep a shared inorder holding 9, 3, 15, 20, and 7. Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared preindex of 0. Keep a shared index of 0. Keep a shared parent of -1. Keep a shared side of 0.\nTo attach from instart (a whole number) with inend (a whole number). If instart is more than inend, return. The current is preindex. The root is item current of preorder. Add 1 to preindex. The slot is index. Add 1 to index. Place root into values. Place -1 into lefts. Place -1 into rights. The anchor is parent. If anchor is at least 0 and side is 0, set item anchor of lefts to slot. If anchor is at least 0 and side is 1, set item anchor of rights to slot. The split is instart. For every spot from instart to inend, if item spot of inorder is root, set split to spot. Set parent to slot. Set side to 0. Attach from instart with split minus 1. Set parent to slot. Set side to 1. Attach from split plus 1 with inend.\n\nAttach from 0 with 4. Keep a shared order as an empty list of whole numbers.\nTo gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Gather from item node of rights. Place node into order.\n\nGather from 0. For each node in order, show item node of values.\n","expected":"9\n15\n7\n20\n3\n","step_budget":2000000},{"id":106,"slug":"construct-binary-tree-from-inorder-and-postorder-traversal","title":"Construct Binary Tree from Inorder and Postorder Traversal","difficulty":"Medium","category":"Array","code":"Keep a shared inorder holding 9, 3, 15, 20, and 7. Keep a shared postorder holding 9, 15, 7, 20, and 3. Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared postindex of 0. Keep a shared index of 0. Keep a shared parent of -1. Keep a shared side of 0.\nTo attach from instart (a whole number) with inend (a whole number). If instart is more than inend, return. The current is postindex. The root is item current of postorder. Subtract 1 from postindex. The slot is index. Add 1 to index. Place root into values. Place -1 into lefts. Place -1 into rights. The anchor is parent. If anchor is at least 0 and side is 0, set item anchor of lefts to slot. If anchor is at least 0 and side is 1, set item anchor of rights to slot. The split is instart. For every spot from instart to inend, if item spot of inorder is root, set split to spot. Set parent to slot. Set side to 1. Attach from split plus 1 with inend. Set parent to slot. Set side to 0. Attach from instart with split minus 1.\n\nSet postindex to 4. Attach from 0 with 4. Keep a shared order as an empty list of whole numbers.\nTo gather from node (a whole number). If node is less than 0, return. Place node into order. Gather from item node of lefts. Gather from item node of rights.\n\nGather from 0. For each node in order, show item node of values.\n","expected":"3\n9\n20\n15\n7\n","step_budget":2000000},{"id":107,"slug":"binary-tree-level-order-traversal-ii","title":"Binary Tree Level Order Traversal II","difficulty":"Medium","category":"Breadth-First Search","code":"Keep a shared values holding 3, 9, 20, 15, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1.\n\nThe queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The remaining is 1. The nextcount is 0. The line is empty text. The rows is an empty list of text.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The piece is format whole number item node of values as text. If the length of line is more than 0, Place \",\" into line. Place piece into line. If item node of lefts is at least 0, Place item node of lefts into queue, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. If remaining is 0, Place line into rows, set line to empty text, set remaining to nextcount, set nextcount to 0.\n\nThe lastrow is the last position of rows.\nFor every step from 0 to lastrow.\nThe source is lastrow minus step. Show item source of rows.\n","expected":"15,7\n9,20\n3\n","step_budget":2000000},{"id":108,"slug":"convert-sorted-array-to-binary-search-tree","title":"Convert Sorted Array to Binary Search Tree","difficulty":"Easy","category":"Array","code":"Keep a shared numbers holding -10, -3, 0, 5, and 9. Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared index of 0. Keep a shared parent of -1. Keep a shared side of 0.\nTo attach from low (a whole number) with high (a whole number). If low is more than high, return. The middle is the midpoint of low and high. The root is item middle of numbers. The slot is index. Add 1 to index. Place root into values. Place -1 into lefts. Place -1 into rights. The anchor is parent. If anchor is at least 0 and side is 0, set item anchor of lefts to slot. If anchor is at least 0 and side is 1, set item anchor of rights to slot. Set parent to slot. Set side to 0. Attach from low with middle minus 1. Set parent to slot. Set side to 1. Attach from middle plus 1 with high.\n\nAttach from 0 with 4. For each value in values, show value.\n","expected":"0\n-10\n-3\n5\n9\n","step_budget":2000000},{"id":109,"slug":"convert-sorted-list-to-binary-search-tree","title":"Convert Sorted List to Binary Search Tree","difficulty":"Medium","category":"Tree","code":"Keep a shared numbers holding -10, -3, 0, 5, and 9. Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared index of 0. Keep a shared parent of -1. Keep a shared side of 0.\nTo shape from low (a whole number) with high (a whole number). If low is more than high, return. The middle is the midpoint of low and high. The root is item middle of numbers. The slot is index. Add 1 to index. Place root into values. Place -1 into lefts. Place -1 into rights. The anchor is parent. If anchor is at least 0 and side is 0, set item anchor of lefts to slot. If anchor is at least 0 and side is 1, set item anchor of rights to slot. Set parent to slot. Set side to 0. Shape from low with middle minus 1. Set parent to slot. Set side to 1. Shape from middle plus 1 with high.\n\nShape from 0 with 4. For each value in values, show value.\n","expected":"0\n-10\n-3\n5\n9\n","step_budget":2000000},{"id":110,"slug":"balanced-binary-tree","title":"Balanced Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 3, 9, 20, 15, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1.\n\nThe last is the last position of values. The size is last plus 1. The heights is a list of size zeros.\nFor every step from 0 to last.\nThe node is last minus step. The leftheight is 0. The rightheight is 0. The left is item node of lefts. The right is item node of rights. If left is at least 0, set leftheight to item left of heights. If right is at least 0, set rightheight to item right of heights. The tall is leftheight. If rightheight is more than tall, set tall to rightheight. Set item node of heights to tall plus 1.\n\nThe good is 1.\nFor every node from 0 to last.\nThe leftheight is 0. The rightheight is 0. The left is item node of lefts. The right is item node of rights. If left is at least 0, set leftheight to item left of heights. If right is at least 0, set rightheight to item right of heights. The difference is leftheight minus rightheight. If difference is more than 1, set good to 0. If difference is less than -1, set good to 0.\n\nIf good is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":111,"slug":"minimum-depth-of-binary-tree","title":"Minimum Depth of Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 3, 9, 20, 15, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1. Keep a shared best of 1000000.\nTo walk from node (a whole number) with depth (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 -1 and right is -1, if depth is less than best, set best to depth, return. Walk from left with depth plus 1. Walk from right with depth plus 1.\n\nWalk from 0 with 1. Show best.\n","expected":"2\n","step_budget":2000000},{"id":112,"slug":"path-sum","title":"Path Sum","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 5, 4, 8, 11, -1, 13, 4, 7, 2, -1, -1, -1, and 1. Keep a shared lefts holding 1, 3, 5, 7, 9, 11, -1, -1, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, 8, 10, 12, -1, -1, -1, -1, -1, -1, and -1. Keep a shared target of 0. Keep a shared found of 0. Set target to 22.\nTo seek from node (a whole number) with total (a whole number). If found is 1, return. If node is less than 0, return. The sum is total plus item node of values. The left is item node of lefts. The right is item node of rights. If left is -1 and right is -1 and sum is target, set found to 1, return. Seek from left with sum. Seek from right with sum.\n\nSeek from 0 with 0. If found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":113,"slug":"path-sum-ii","title":"Path Sum II","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 5, 4, 8, 11, 6, 4, 7, 2, 5, and 1. Keep a shared lefts holding 1, 3, 5, 6, -1, 8, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, 7, -1, 9, -1, -1, -1, and -1. Keep a shared path as an empty list of whole numbers. Keep a shared answers as an empty list of text. Keep a shared target of 0. Keep a shared line as empty text. Set target to 22.\nTo render from spot (a whole number) with last (a whole number). If spot is more than last, return. If the length of line is more than 0, Place \",\" into line. The piece is format whole number item spot of path as text. Place piece into line. Render from spot plus 1 with last.\n\nTo store answer. Set line to empty text. The lastpath is the last position of path. Render from 0 with lastpath. The copy is a copy of line. Place copy into answers.\n\nTo seek from node (a whole number) with total (a whole number). If node is less than 0, return. The sum is total plus item node of values. Place item node of values into path. The left is item node of lefts. The right is item node of rights. If left is -1 and right is -1 and sum is target, store answer. If left is at least 0, seek from left with sum. If right is at least 0, seek from right with sum. Remove the last item from path.\n\nSeek from 0 with 0. For each answer in answers, show answer.\n","expected":"5,4,11,2\n5,8,4,5\n","step_budget":2000000},{"id":114,"slug":"flatten-binary-tree-to-linked-list","title":"Flatten Binary Tree to Linked List","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 5, 3, 4, and 6. Keep a shared lefts holding 1, 3, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 5, -1, -1, and -1. Keep a shared order as an empty list of whole numbers.\nTo gather from node (a whole number). If node is less than 0, return. Place node into order. Gather from item node of lefts. Gather from item node of rights.\n\nGather from 0. For each node in order, show item node of values.\n","expected":"1\n2\n3\n4\n5\n6\n","step_budget":2000000},{"id":115,"slug":"distinct-subsequences","title":"Distinct Subsequences","difficulty":"Hard","category":"String","code":"Keep a shared source as empty text. Keep a shared target as empty text. Keep a shared dp as an empty list of whole numbers. Place \"rabbbit\" into source. Place \"rabbit\" into target. The targetsize is 6.\nFor every spot from 0 to 6.\nPlace 0 into dp.\n\nSet item 0 of dp to 1.\nTo scan from spot (a whole number) with symbol (a whole number). If spot is less than 1, return. If character (spot minus 1) of target is symbol, set item spot of dp to item spot of dp plus item (spot minus 1) of dp. Scan from spot minus 1 with symbol.\n\nThe last is the last position of source.\nFor every position from 0 to last.\nScan from targetsize with character position of source.\n\nShow item targetsize of dp.\n","expected":"3\n","step_budget":2000000},{"id":116,"slug":"populating-next-right-pointers-in-each-node","title":"Populating Next Right Pointers in Each Node","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, 4, 5, 6, and 7. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1.\n\nThe nexts is an empty list of whole numbers. For every spot from 0 to 6, Place -1 into nexts. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The remaining is 1. The nextcount is 0. The previous is -1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. If previous is at least 0, set item previous of nexts to node. Set previous to node. If item node of lefts is at least 0, Place item node of lefts into queue, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. If remaining is 0, set previous to -1, set remaining to nextcount, set nextcount to 0.\n\nFor every node from 0 to 6.\nThe line is format whole number item node of values as text. Place \" \" into line. The next is item node of nexts. If next is at least 0, Place format whole number item next of values as text into line, otherwise Place \"-1\" into line. Show line.\n","expected":"1 -1\n2 3\n3 -1\n4 5\n5 6\n6 7\n7 -1\n","step_budget":2000000},{"id":117,"slug":"populating-next-right-pointers-in-each-node-ii","title":"Populating Next Right Pointers in Each Node II","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, 4, 5, and 7. Keep a shared lefts holding 1, 3, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 5, -1, -1, and -1.\n\nThe nexts is an empty list of whole numbers. For every spot from 0 to 5, Place -1 into nexts. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The remaining is 1. The nextcount is 0. The previous is -1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. If previous is at least 0, set item previous of nexts to node. Set previous to node. If item node of lefts is at least 0, Place item node of lefts into queue, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. If remaining is 0, set previous to -1, set remaining to nextcount, set nextcount to 0.\n\nFor every node from 0 to 5.\nThe line is format whole number item node of values as text. Place \" \" into line. The next is item node of nexts. If next is at least 0, Place format whole number item next of values as text into line, otherwise Place \"-1\" into line. Show line.\n","expected":"1 -1\n2 3\n3 -1\n4 5\n5 7\n7 -1\n","step_budget":2000000},{"id":118,"slug":"pascals-triangle","title":"Pascal's Triangle","difficulty":"Easy","category":"Array","code":"Keep a shared previous as an empty list of whole numbers. Keep a shared current as an empty list of whole numbers. Keep a shared line as empty text.\nFor every spot from 0 to 4.\nPlace 0 into previous. Place 0 into current.\n\nTo shape from spot (a whole number) with level (a whole number). If spot is more than level, return. The value is 1. If spot is more than 0 and spot is less than level, set value to item (spot minus 1) of previous plus item spot of previous. Set item spot of current to value. If spot is more than 0, Place \",\" into line. Place format whole number value as text into line. Shape from spot plus 1 with level.\n\nTo carry from spot (a whole number) with level (a whole number). If spot is more than level, return. Set item spot of previous to item spot of current. Carry from spot plus 1 with level.\n\nFor every level from 0 to 4.\nSet line to empty text. Shape from 0 with level. Show line. Carry from 0 with level.\n","expected":"1\n1,1\n1,2,1\n1,3,3,1\n1,4,6,4,1\n","step_budget":2000000},{"id":119,"slug":"pascals-triangle-ii","title":"Pascal's Triangle II","difficulty":"Easy","category":"Array","code":"Keep a shared previous as an empty list of whole numbers. Keep a shared current as an empty list of whole numbers. Keep a shared line as empty text.\nFor every spot from 0 to 4.\nPlace 0 into previous. Place 0 into current.\n\nTo shape from spot (a whole number) with level (a whole number). If spot is more than level, return. The value is 1. If spot is more than 0 and spot is less than level, set value to item (spot minus 1) of previous plus item spot of previous. Set item spot of current to value. If spot is more than 0, Place \",\" into line. Place format whole number value as text into line. Shape from spot plus 1 with level.\n\nTo carry from spot (a whole number) with level (a whole number). If spot is more than level, return. Set item spot of previous to item spot of current. Carry from spot plus 1 with level.\n\nFor every level from 0 to 3.\nSet line to empty text. Shape from 0 with level. Carry from 0 with level.\n\nShow line.\n","expected":"1,3,3,1\n","step_budget":2000000},{"id":120,"slug":"triangle","title":"Triangle","difficulty":"Medium","category":"Array","code":"The values is a list of 2, 3, 4, 6, 5, 7, 4, 1, 8, and 3. The starts is a list of 0, 1, 3, and 6. The success as an empty list of whole numbers. Keep a shared valueslist holding 2, 3, 4, 6, 5, 7, 4, 1, 8, and 3. Keep a shared startslist holding 0, 1, 3, and 6. The dp is a list of 10 zeros.\nFor every spot from 6 to 9.\nSet item spot of dp to item spot of valueslist.\n\nThe rows is a list of 2, 2, 2, 1, 1, and 0. The columns is a list of 0, 1, 2, 0, 1, and 0.\nFor every step from 0 to 5.\nThe row is item step of rows. The column is item step of columns. The base is item row of startslist. The below is item (row plus 1) of startslist. The here is item (base plus column) of valueslist. The first is item (below plus column) of dp. The second is item (below plus column plus 1) of dp. The small is first. If second is less than small, set small to second. Set item (base plus column) of dp to here plus small.\n\nShow item 0 of dp.\n","expected":"11\n","step_budget":2000000},{"id":121,"slug":"best-time-to-buy-and-sell-stock","title":"Best Time to Buy and Sell Stock","difficulty":"Easy","category":"Array","code":"The prices is a list of 7, 1, 5, 3, 6, and 4. The last is the last position of prices. The cheapest is item 0 of prices. The best is 0.\nFor every spot from 1 to last.\nThe price is item spot of prices. The gain is price minus cheapest. If gain is more than best, set best to gain. If price is less than cheapest, set cheapest to price.\n\nShow best.\n","expected":"5\n","step_budget":2000000},{"id":122,"slug":"best-time-to-buy-and-sell-stock-ii","title":"Best Time to Buy and Sell Stock II","difficulty":"Medium","category":"Array","code":"The prices is a list of 7, 1, 5, 3, 6, and 4. The last is the last position of prices. The profit is 0.\nFor every spot from 1 to last.\nThe gain is item spot of prices minus item (spot minus 1) of prices. If gain is more than 0, add gain to profit.\n\nShow profit.\n","expected":"7\n","step_budget":2000000},{"id":123,"slug":"best-time-to-buy-and-sell-stock-iii","title":"Best Time to Buy and Sell Stock III","difficulty":"Hard","category":"Array","code":"The prices is a list of 3, 3, 5, 0, 0, 3, 1, and 4. The last is the last position of prices. The firstbuy is -1000000. The firstsell is 0. The secondbuy is -1000000. The secondsell is 0.\nFor every spot from 0 to last.\nThe price is item spot of prices. The trial is 0 minus price. If trial is more than firstbuy, set firstbuy to trial. The trial is firstbuy plus price. If trial is more than firstsell, set firstsell to trial. The trial is firstsell minus price. If trial is more than secondbuy, set secondbuy to trial. The trial is secondbuy plus price. If trial is more than secondsell, set secondsell to trial.\n\nShow secondsell.\n","expected":"6\n","step_budget":2000000},{"id":124,"slug":"binary-tree-maximum-path-sum","title":"Binary Tree Maximum Path Sum","difficulty":"Hard","category":"Dynamic Programming","code":"Keep a shared values holding -10, 9, 20, -1, -1, 15, and 7. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1.\n\nThe last is the last position of values. The size is last plus 1. The gains is a list of size zeros. The best is 0.\nFor every step from 0 to last.\nThe node is last minus step. The value is item node of values.\nIf value is at least 0.\nThe leftgain is 0. The rightgain is 0. The left is item node of lefts. The right is item node of rights. If left is at least 0, set leftgain to item left of gains. If right is at least 0, set rightgain to item right of gains. If leftgain is less than 0, set leftgain to 0. If rightgain is less than 0, set rightgain to 0. The through is value plus leftgain plus rightgain. If through is more than best, set best to through. The gain is value. If leftgain is more than rightgain and leftgain is more than 0, set gain to value plus leftgain. If rightgain is at least leftgain and rightgain is more than 0, set gain to value plus rightgain. Set item node of gains to gain.\n\nShow best.\n","expected":"42\n","step_budget":2000000},{"id":125,"slug":"valid-palindrome","title":"Valid Palindrome","difficulty":"Easy","category":"String","code":"Keep a shared upper as empty text. Keep a shared lower as empty text. Keep a shared clean as empty text. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into upper. Place \"abcdefghijklmnopqrstuvwxyz\" into lower.\nTo filter from spot (a whole number) with symbol (a whole number). If symbol is between \"0\" and \"9\", Place symbol into clean, return. If spot is more than 25, return. If symbol is character spot of lower, Place symbol into clean, return. If symbol is character spot of upper, Place character spot of lower into clean, return. Filter from spot plus 1 with symbol.\n\nThe word is \"A man, a plan, a canal: Panama\". The last is the last position of word.\nFor every position from 0 to last.\nFilter from 0 with character position of word.\n\nThe left is 0. The right is the last position of clean. The valid is 1.\nRepeat while left is less than right.\nIf character left of clean is not character right of clean, set valid to 0. Add 1 to left. Subtract 1 from right.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":126,"slug":"word-ladder-ii","title":"Word Ladder II","difficulty":"Hard","category":"String","code":"Keep a shared words holding \"hit\", \"hot\", \"dot\", \"dog\", \"lot\", \"log\", and \"cog\". Keep a shared firstword as empty text. Keep a shared secondword as empty text. Keep a shared apart of 0. Keep a shared used as an empty list of whole numbers. Keep a shared path as an empty list of whole numbers. Keep a shared answers as an empty list of text. Keep a shared line as empty text. Keep a shared depth of 0.\nFor every spot from 0 to 6.\nPlace 0 into used.\n\nTo compare from spot (a whole number) with last (a whole number). If spot is more than last, return. If character spot of firstword is not character spot of secondword, add 1 to apart. Compare from spot plus 1 with last.\n\nTo render from spot (a whole number) with last (a whole number). If spot is more than last, return. If spot is more than 0, Place \" \" into line. The node is item spot of path. Place item node of words into line. Render from spot plus 1 with last.\n\nTo store path. Set line to empty text. The lastpath is the last position of path. Render from 0 with lastpath. The copy is a copy of line. Place copy into answers.\n\nTo extend from current (a whole number) with candidate (a whole number). Set item candidate of used to 1. Place candidate into path. Add 1 to depth. If candidate is 6 and depth is 4, store path. If candidate is not 6 and depth is less than 4, walk from candidate with 0. Subtract 1 from depth. Remove the last item from path. Set item candidate of used to 0.\n\nTo walk from current (a whole number) with candidate (a whole number). If depth is 4, return. If candidate is more than 6, return. If item candidate of used is 1, walk from current with candidate plus 1, return. Set firstword to item current of words. Set secondword to item candidate of words. Set apart to 0. Compare from 0 with 2. If apart is 1, extend from current with candidate. Walk from current with candidate plus 1.\n\nSet item 0 of used to 1. Place 0 into path. Walk from 0 with 0. For each answer in answers, show answer.\n","expected":"hit hot dot dog cog\nhit hot lot log cog\n","step_budget":2000000},{"id":127,"slug":"word-ladder","title":"Word Ladder","difficulty":"Hard","category":"String","code":"Keep a shared words holding \"hit\", \"hot\", \"dot\", \"dog\", \"lot\", \"log\", and \"cog\". Keep a shared firstword as empty text. Keep a shared secondword as empty text. Keep a shared apart of 0.\nTo compare from spot (a whole number) with last (a whole number). If spot is more than last, return. If character spot of firstword is not character spot of secondword, add 1 to apart. Compare from spot plus 1 with last.\n\nKeep a shared seen as an empty list of whole numbers. Keep a shared distance as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared count of 0.\nFor every spot from 0 to 6.\nPlace 0 into seen. Place 0 into distance.\n\nPlace 0 into queue. Set item 0 of seen to 1. Set item 0 of distance to 1. The head is 0. Set count to 1.\nTo expand from current (a whole number) with candidate (a whole number). If candidate is more than 6, return. If item candidate of seen is 1, expand from current with candidate plus 1, return. Set firstword to item current of words. Set secondword to item candidate of words. Set apart to 0. Compare from 0 with 2. If apart is 1, set item candidate of seen to 1, set item candidate of distance to item current of distance plus 1, Place candidate into queue, add 1 to count. Expand from current with candidate plus 1.\n\nRepeat while head is less than count.\nThe current is item head of queue. Add 1 to head. Expand from current with 1.\n\nIf item 6 of seen is 1, show item 6 of distance, otherwise show 0.\n","expected":"5\n","step_budget":2000000},{"id":128,"slug":"longest-consecutive-sequence","title":"Longest Consecutive Sequence","difficulty":"Medium","category":"Array","code":"The numbers is a list of 100, 4, 200, 1, 3, and 2. Sort numbers. The last is the last position of numbers. The best is 1. The run is 1.\nFor every spot from 1 to last.\nThe current is item spot of numbers. The before is item (spot minus 1) of numbers. If current is before plus 1, add 1 to run. If current is not before and current is not before plus 1, set run to 1. If run is more than best, set best to run.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":129,"slug":"sum-root-to-leaf-numbers","title":"Sum Root to Leaf Numbers","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, and 3. Keep a shared lefts holding 1, -1, and -1. Keep a shared rights holding 2, -1, and -1. Keep a shared total of 0.\nTo walk from node (a whole number) with value (a whole number). If node is less than 0, return. The current is value times 10 plus item node of values. The left is item node of lefts. The right is item node of rights. If left is -1 and right is -1, add current to total, return. Walk from left with current. Walk from right with current.\n\nWalk from 0 with 0. Show total.\n","expected":"25\n","step_budget":2000000},{"id":130,"slug":"surrounded-regions","title":"Surrounded Regions","difficulty":"Medium","category":"Array","code":"Keep a shared board holding 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, and 1. Keep a shared safe as an empty list of whole numbers.\nFor every spot from 0 to 15.\nPlace 0 into safe.\n\nThe queue is an empty list of whole numbers. The count is 0. The head is 0.\nFor every spot from 0 to 15.\nThe row is spot divided by 4. The column is spot modulo 4.\nIf row is 0 or row is 3 or column is 0 or column is 3.\nIf item spot of board is 0 and item spot of safe is 0, set item spot of safe to 1, Place spot into queue, add 1 to count.\n\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The row is node divided by 4. The column is node modulo 4. If row is more than 0 and item (node minus 4) of board is 0 and item (node minus 4) of safe is 0, set item (node minus 4) of safe to 1, Place (node minus 4) into queue, add 1 to count. If row is less than 3 and item (node plus 4) of board is 0 and item (node plus 4) of safe is 0, set item (node plus 4) of safe to 1, Place (node plus 4) into queue, add 1 to count. If column is more than 0 and item (node minus 1) of board is 0 and item (node minus 1) of safe is 0, set item (node minus 1) of safe to 1, Place (node minus 1) into queue, add 1 to count. If column is less than 3 and item (node plus 1) of board is 0 and item (node plus 1) of safe is 0, set item (node plus 1) of safe to 1, Place (node plus 1) into queue, add 1 to count.\n\nKeep a shared line as empty text.\nTo render from spot (a whole number) with last (a whole number). If spot is more than last, return. If item spot of board is 1 or item spot of safe is 0, Place \"X\" into line, otherwise Place \"O\" into line. Render from spot plus 1 with last.\n\nFor every row from 0 to 3.\nSet line to empty text. The start is row times 4. The finish is start plus 3. Render from start with finish. Show line.\n","expected":"XXXX\nXXXX\nXXXX\nXOXX\n","step_budget":2000000},{"id":131,"slug":"palindrome-partitioning","title":"Palindrome Partitioning","difficulty":"Medium","category":"String","code":"Keep a shared word as empty text. Place \"aab\" into word. Keep a shared path as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared pal of 1.\nTo test from left (a whole number) with right (a whole number). If left is at least right, return. If character left of word is not character right of word, set pal to 0, return. Test from left plus 1 with right minus 1.\n\nTo store answer. The line is join path with \",\". Place line into answers.\n\nTo extend from start (a whole number) with finish (a whole number). The piece is the slice of word from start to finish plus 1. Place piece into path. If finish is 2, store answer. If finish is less than 2, scan from finish plus 1 with finish plus 1. Remove the last item from path.\n\nTo scan from start (a whole number) with finish (a whole number). If finish is more than 2, return. Set pal to 1. Test from start with finish. If pal is 1, extend from start with finish. Scan from start with finish plus 1.\n\nScan from 0 with 0. For each answer in answers, show answer.\n","expected":"a,a,b\naa,b\n","step_budget":2000000},{"id":132,"slug":"palindrome-partitioning-ii","title":"Palindrome Partitioning II","difficulty":"Hard","category":"String","code":"Keep a shared word as empty text. Place \"aab\" into word. Keep a shared cuts as an empty list of whole numbers.\nFor every spot from 0 to 3.\nPlace spot into cuts.\n\nKeep a shared pal of 1.\nTo test from left (a whole number) with right (a whole number). If left is at least right, return. If character left of word is not character right of word, set pal to 0, return. Test from left plus 1 with right minus 1.\n\nTo improve from finish (a whole number) with start (a whole number). The candidate is item start of cuts plus 1. If candidate is less than item finish of cuts, set item finish of cuts to candidate.\n\nTo relax from finish (a whole number) with start (a whole number). If start is less than 0, return. Set pal to 1. Test from start with finish minus 1. If pal is 1, improve from finish with start. Relax from finish with start minus 1.\n\nFor every finish from 1 to 3.\nRelax from finish with finish minus 1.\n\nShow item 3 of cuts minus 1.\n","expected":"1\n","step_budget":2000000},{"id":133,"slug":"clone-graph","title":"Clone Graph","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared edges holding 1, 3, 0, 2, 1, 3, 0, and 2. Keep a shared starts holding 0, 2, 4, and 6. Keep a shared counts holding 2, 2, 2, and 2. Keep a shared copyedges as an empty list of whole numbers. Keep a shared copystarts as an empty list of whole numbers. Keep a shared copycounts as an empty list of whole numbers.\nFor each edge in edges.\nPlace edge into copyedges.\n\nFor each start in starts.\nPlace start into copystarts.\n\nFor each count in counts.\nPlace count into copycounts.\n\nKeep a shared line as empty text.\nTo list from node (a whole number) with spot (a whole number). If spot is more than item node of copycounts, return. If spot is more than 0, Place \" \" into line. The base is item node of copystarts. The target is item (base plus spot minus 1) of copyedges. Place format whole number target plus 1 as text into line. List from node with spot plus 1.\n\nFor every node from 0 to 3.\nSet line to format whole number node plus 1 as text. List from node with 1. Show line.\n","expected":"1 2 4\n2 1 3\n3 2 4\n4 1 3\n","step_budget":2000000},{"id":134,"slug":"gas-station","title":"Gas Station","difficulty":"Medium","category":"Array","code":"The gas is a list of 1, 2, 3, 4, and 5. The cost is a list of 3, 4, 5, 1, and 2. The last is the last position of gas. The total is 0. The tank is 0. The start is 0.\nFor every spot from 0 to last.\nThe gain is item spot of gas minus item spot of cost. Add gain to total. Add gain to tank. If tank is less than 0, set start to spot plus 1, set tank to 0.\n\nIf total is at least 0, show start, otherwise show -1.\n","expected":"3\n","step_budget":2000000},{"id":135,"slug":"candy","title":"Candy","difficulty":"Hard","category":"Array","code":"The ratings is a list of 1, 0, and 2. The last is the last position of ratings. The candies is an empty list of whole numbers.\nFor every spot from 0 to last.\nPlace 1 into candies.\n\nFor every spot from 1 to last.\nIf item spot of ratings is more than item (spot minus 1) of ratings, set item spot of candies to item (spot minus 1) of candies plus 1.\n\nFor every step from 0 to last.\nThe spot is last minus step.\nIf spot is less than last and item spot of ratings is more than item (spot plus 1) of ratings.\nIf item spot of candies is at most item (spot plus 1) of candies, set item spot of candies to item (spot plus 1) of candies plus 1.\n\nThe total is 0.\nFor each candy in candies.\nAdd candy to total.\n\nShow total.\n","expected":"5\n","step_budget":2000000},{"id":136,"slug":"single-number","title":"Single Number","difficulty":"Easy","category":"Array","code":"The numbers is a list of 4, 1, 2, 1, and 2. The answer is 0.\nFor each value in numbers.\nSet answer to exclusive or of answer and value.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":137,"slug":"single-number-ii","title":"Single Number II","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 2, 2, 3, and 2. Keep a shared occurrences of 0. Keep a shared lastindex of 3.\nTo count from spot (a whole number) with target (a whole number). If spot is more than lastindex, return. If item spot of numbers is target, add 1 to occurrences. Count from spot plus 1 with target.\n\nFor each candidate in numbers.\nSet occurrences to 0. Count from 0 with candidate. If occurrences is 1, show candidate.\n","expected":"3\n","step_budget":2000000},{"id":138,"slug":"copy-list-with-random-pointer","title":"Copy List with Random Pointer","difficulty":"Medium","category":"Linked List","code":"The values is a list of 7, 13, 11, 10, and 1. The nexts is a list of 1, 2, 3, 4, and -1. The randoms is a list of -1, 0, 4, 2, and 0. The copyvalues is an empty list of whole numbers. The copynexts is an empty list of whole numbers. The copyrandoms is an empty list of whole numbers.\nFor each value in values.\nPlace value into copyvalues.\n\nFor each next in nexts.\nPlace next into copynexts.\n\nFor each random in randoms.\nPlace random into copyrandoms.\n\nFor every node from 0 to 4.\nThe line is format whole number item node of copyvalues as text. Place \" \" into line. The random is item node of copyrandoms. If random is at least 0, Place format whole number item random of copyvalues as text into line, otherwise Place \"-1\" into line. Show line.\n","expected":"7 -1\n13 7\n11 1\n10 11\n1 7\n","step_budget":2000000},{"id":139,"slug":"word-break","title":"Word Break","difficulty":"Medium","category":"Array","code":"Keep a shared source as empty text. Keep a shared words as an empty list of text. Keep a shared lengths as an empty list of whole numbers. Place \"leetcode\" into source. Place \"leet\" into words. Place \"code\" into words. Place 4 into lengths. Place 4 into lengths. Keep a shared dp as an empty list of whole numbers.\nFor every spot from 0 to 8.\nPlace 0 into dp.\n\nSet item 0 of dp to 1.\nTo check from finish (a whole number) with spot (a whole number). If spot is more than 1, return. The size is item spot of lengths. If size is more than finish, check from finish with spot plus 1, return. The start is finish minus size. The piece is the slice of source from start to finish. The word is item spot of words. If piece does not match word, check from finish with spot plus 1, return. If item start of dp is 1, set item finish of dp to 1. Check from finish with spot plus 1.\n\nFor every finish from 1 to 8.\nCheck from finish with 0.\n\nIf item 8 of dp is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":140,"slug":"word-break-ii","title":"Word Break II","difficulty":"Hard","category":"Array","code":"Keep a shared text as empty text. Keep a shared words as an empty list of text. Keep a shared lengths as an empty list of whole numbers. Keep a shared path as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared textsize of 0. Place \"catsanddog\" into text. Place \"cats\" into words. Place \"cat\" into words. Place \"and\" into words. Place \"sand\" into words. Place \"dog\" into words. Place 4 into lengths. Place 3 into lengths. Place 3 into lengths. Place 4 into lengths. Place 3 into lengths. Set textsize to 10.\nTo store answer. The line is join path with \" \". Place line into answers.\n\nTo try from start (a whole number) with spot (a whole number). If start is textsize, store answer, return. If spot is more than 4, return. The size is item spot of lengths. If start plus size is more than textsize, try from start with spot plus 1, return. The finish is start plus size. The piece is the slice of text from start to finish. If piece does not match item spot of words, try from start with spot plus 1, return. Place item spot of words into path. Try from finish with 0. Remove the last item from path. Try from start with spot plus 1.\n\nTry from 0 with 0. For each answer in answers, show answer.\n","expected":"cats and dog\ncat sand dog\n","step_budget":2000000},{"id":141,"slug":"linked-list-cycle","title":"Linked List Cycle","difficulty":"Easy","category":"Two Pointers","code":"The values is a list of 3, 2, 0, and -4. The nexts is a list of 1, 2, 3, and 1. The visited is a list of 4 zeros. The node is 0.\nRepeat while node is at least 0 and item node of visited is 0.\nSet item node of visited to 1. Set node to item node of nexts.\n\nIf node is at least 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":142,"slug":"linked-list-cycle-ii","title":"Linked List Cycle II","difficulty":"Medium","category":"Two Pointers","code":"The values is a list of 3, 2, 0, and -4. The nexts is a list of 1, 2, 3, and 1. The visited is a list of 4 zeros. The order is an empty list of whole numbers. The node is 0.\nRepeat while node is at least 0 and item node of visited is 0.\nSet item node of visited to 1. Place node into order. Set node to item node of nexts.\n\nIf node is less than 0, show -1, otherwise show node.\n","expected":"1\n","step_budget":2000000},{"id":143,"slug":"reorder-list","title":"Reorder List","difficulty":"Medium","category":"Stack","code":"The values is a list of 1, 2, 3, and 4. The left is 0. The right is 3. The take is 0. The result is an empty list of whole numbers.\nRepeat while left is at most right.\nIf take is 0, Place item left of values into result, add 1 to left. If take is 1, Place item right of values into result, subtract 1 from right. Set take to 1 minus take.\n\nFor each value in result, show value.\n","expected":"1\n4\n2\n3\n","step_budget":2000000},{"id":144,"slug":"binary-tree-preorder-traversal","title":"Binary Tree Preorder Traversal","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, and 3. Keep a shared lefts holding -1, -1, and -1. Keep a shared rights holding 1, 2, and -1. Keep a shared order as an empty list of whole numbers.\nTo gather from node (a whole number). If node is less than 0, return. Place node into order. Gather from item node of lefts. Gather from item node of rights.\n\nGather from 0. For each node in order, show item node of values.\n","expected":"1\n2\n3\n","step_budget":2000000},{"id":145,"slug":"binary-tree-postorder-traversal","title":"Binary Tree Postorder Traversal","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, and 3. Keep a shared lefts holding -1, -1, and -1. Keep a shared rights holding 1, 2, and -1. Keep a shared order as an empty list of whole numbers.\nTo gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Gather from item node of rights. Place node into order.\n\nGather from 0. For each node in order, show item node of values.\n","expected":"3\n2\n1\n","step_budget":2000000},{"id":147,"slug":"insertion-sort-list","title":"Insertion Sort List","difficulty":"Medium","category":"Sorting","code":"Keep a shared values holding 4, 2, 1, and 3.\nTo shift from spot (a whole number) with key (a whole number). If spot is less than 0, set item 0 of values to key, return. If item spot of values is at most key, set item (spot plus 1) of values to key, return. Set item (spot plus 1) of values to item spot of values. Shift from spot minus 1 with key.\n\nThe last is 3.\nFor every spot from 1 to last.\nThe key is item spot of values. Shift from spot minus 1 with key.\n\nFor each value in values, show value.\n","expected":"1\n2\n3\n4\n","step_budget":2000000},{"id":148,"slug":"sort-list","title":"Sort List","difficulty":"Medium","category":"Sorting","code":"Keep a shared values holding 4, 2, 1, and 3.\nTo place from spot (a whole number) with key (a whole number). If spot is less than 0, set item 0 of values to key, return. If item spot of values is at most key, set item (spot plus 1) of values to key, return. Set item (spot plus 1) of values to item spot of values. Place from spot minus 1 with key.\n\nThe last is 3.\nFor every spot from 1 to last.\nThe key is item spot of values. Place from spot minus 1 with key.\n\nFor each value in values, show value.\n","expected":"1\n2\n3\n4\n","step_budget":2000000},{"id":149,"slug":"max-points-on-a-line","title":"Max Points on a Line","difficulty":"Hard","category":"Array","code":"Keep a shared xs as an empty list of whole numbers. Keep a shared ys as an empty list of whole numbers. Place 1 into xs. Place 2 into xs. Place 3 into xs. Place 1 into ys. Place 2 into ys. Place 3 into ys. Keep a shared linefirst of 0. Keep a shared linesecond of 0. Keep a shared linecount of 0. Keep a shared best of 0. Keep a shared lastpoint of 0. Set best to 1. Set lastpoint to 2.\nTo check point at spot (a whole number). The anchor is linefirst. The other is linesecond. The dx is item other of xs minus item anchor of xs. The dy is item other of ys minus item anchor of ys. The otherx is item spot of xs minus item anchor of xs. The othery is item spot of ys minus item anchor of ys. If dx times othery is dy times otherx, add 1 to linecount.\n\nTo scan from spot (a whole number). If spot is more than lastpoint, return. If spot is not linefirst and spot is not linesecond, check point at spot. Scan from spot plus 1.\n\nTo score from first (a whole number) with second (a whole number). Set linefirst to first. Set linesecond to second. Set linecount to 2. Scan from 0. If linecount is more than best, set best to linecount.\n\nFor every first from 0 to lastpoint.\nFor every second from first plus 1 to lastpoint.\nScore from first with second.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":150,"slug":"evaluate-reverse-polish-notation","title":"Evaluate Reverse Polish Notation","difficulty":"Medium","category":"Array","code":"Keep a shared tokens holding \"2\", \"1\", \"+\", \"3\", and \"*\". Keep a shared current as empty text. Keep a shared value of 0.\nTo read from spot (a whole number) with last (a whole number). If spot is more than last, return. The digit is the digit value of character spot of current. Set value to value times 10 plus digit. Read from spot plus 1 with last.\n\nThe stack is an empty list of whole numbers. The depth is 0. The left is 0. The right is 0. The result is 0.\nFor each token in tokens.\nSet current to a copy of token. The sign is 1. The start is 0. If character 0 of current is \"-\", set sign to -1, set start to 1. Set value to 0. The lastchar is the last position of current. Read from start with lastchar. Set value to value times sign. The symbol is character 0 of current. If symbol is \"+\", set right to item (depth minus 1) of stack, remove the last item from stack, subtract 1 from depth, set left to item (depth minus 1) of stack, remove the last item from stack, subtract 1 from depth, set result to left plus right, Place result into stack, add 1 to depth. If symbol is \"-\", set right to item (depth minus 1) of stack, remove the last item from stack, subtract 1 from depth, set left to item (depth minus 1) of stack, remove the last item from stack, subtract 1 from depth, set result to left minus right, Place result into stack, add 1 to depth. If symbol is \"*\", set right to item (depth minus 1) of stack, remove the last item from stack, subtract 1 from depth, set left to item (depth minus 1) of stack, remove the last item from stack, subtract 1 from depth, set result to left times right, Place result into stack, add 1 to depth. If symbol is \"/\", set right to item (depth minus 1) of stack, remove the last item from stack, subtract 1 from depth, set left to item (depth minus 1) of stack, remove the last item from stack, subtract 1 from depth, set result to left divided by right, Place result into stack, add 1 to depth. If symbol is between \"0\" and \"9\", Place value into stack, add 1 to depth.\n\nShow item 0 of stack.\n","expected":"9\n","step_budget":2000000},{"id":151,"slug":"reverse-words-in-a-string","title":"Reverse Words in a String","difficulty":"Medium","category":"String","code":"The sentence is \"the sky is blue\". The parts is split sentence by \" \". The words is an empty list of text.\nFor each part in parts.\nIf the length of part is more than 0, Place part into words.\n\nThe last is the last position of words. The result is empty text.\nFor every step from 0 to last.\nThe source is last minus step. If the length of result is more than 0, Place \" \" into result. Place item source of words into result.\n\nShow result.\n","expected":"blue is sky the\n","step_budget":2000000},{"id":152,"slug":"maximum-product-subarray","title":"Maximum Product Subarray","difficulty":"Medium","category":"Array","code":"The numbers is a list of 2, 3, -2, and 4. The last is the last position of numbers. The high is item 0 of numbers. The low is item 0 of numbers. The best is item 0 of numbers.\nFor every spot from 1 to last.\nThe value is item spot of numbers. The first is high times value. The second is low times value. The top is first. If second is more than top, set top to second. If value is more than top, set top to value. The bottom is first. If second is less than bottom, set bottom to second. If value is less than bottom, set bottom to value. Set high to top. Set low to bottom. If high is more than best, set best to high.\n\nShow best.\n","expected":"6\n","step_budget":2000000},{"id":153,"slug":"find-minimum-in-rotated-sorted-array","title":"Find Minimum in Rotated Sorted Array","difficulty":"Medium","category":"Array","code":"The numbers is a list of 3, 4, 5, 1, and 2. The smallest is item 0 of numbers.\nFor each value in numbers.\nIf value is less than smallest, set smallest to value.\n\nShow smallest.\n","expected":"1\n","step_budget":2000000},{"id":154,"slug":"find-minimum-in-rotated-sorted-array-ii","title":"Find Minimum in Rotated Sorted Array II","difficulty":"Hard","category":"Array","code":"The numbers is a list of 2, 2, 2, 0, and 1. The smallest is item 0 of numbers.\nFor each value in numbers.\nIf value is less than smallest, set smallest to value.\n\nShow smallest.\n","expected":"0\n","step_budget":2000000},{"id":160,"slug":"intersection-of-two-linked-lists","title":"Intersection of Two Linked Lists","difficulty":"Easy","category":"Two Pointers","code":"The values is a list of 4, 1, 8, 4, 5, 5, 6, and 1. The nexts is a list of 1, 2, 3, 4, -1, 6, 7, and 2. The first is 0. The second is 5. The firstsize is 0. The secondsize is 0. The node is 0.\nRepeat while node is at least 0.\nAdd 1 to firstsize. Set node to item node of nexts.\n\nSet node to 5.\nRepeat while node is at least 0.\nAdd 1 to secondsize. Set node to item node of nexts.\n\nRepeat while firstsize is more than secondsize.\nSet first to item first of nexts. Subtract 1 from firstsize.\n\nRepeat while secondsize is more than firstsize.\nSet second to item second of nexts. Subtract 1 from secondsize.\n\nRepeat while first is not second.\nSet first to item first of nexts. Set second to item second of nexts.\n\nShow item first of values.\n","expected":"8\n","step_budget":2000000},{"id":162,"slug":"find-peak-element","title":"Find Peak Element","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 2, 3, and 1. The last is the last position of numbers. The peak is 0.\nFor every spot from 0 to last.\nThe higherleft is 1. The higherright is 1. If spot is more than 0 and item (spot minus 1) of numbers is at least item spot of numbers, set higherleft to 0. If spot is less than last and item (spot plus 1) of numbers is at least item spot of numbers, set higherright to 0. If higherleft is 1 and higherright is 1, set peak to spot.\n\nShow peak.\n","expected":"2\n","step_budget":2000000},{"id":164,"slug":"maximum-gap","title":"Maximum Gap","difficulty":"Medium","category":"Array","code":"The numbers is a list of 3, 6, 9, and 1. Sort numbers. The last is the last position of numbers. The best is 0.\nFor every spot from 1 to last.\nThe gap is item spot of numbers minus item (spot minus 1) of numbers. If gap is more than best, set best to gap.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":165,"slug":"compare-version-numbers","title":"Compare Version Numbers","difficulty":"Medium","category":"String","code":"Keep a shared current as empty text. Keep a shared value of 0. Keep a shared foundat of 0. Keep a shared leftvalue of 0. Keep a shared rightvalue of 0. Keep a shared lastfirst of 0. Keep a shared lastsecond of 0. Keep a shared firsts as an empty list of text. Keep a shared seconds as an empty list of text.\nTo parse from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The digit is the digit value of character spot of current. Set value to value times 10 plus digit. Parse from spot plus 1 with finish.\n\nTo parse segment. The finish is the last position of current. Parse from 0 with finish.\n\nTo read left at spot (a whole number). If spot is more than lastfirst, return. Set current to item spot of firsts. Set value to 0. Parse segment. Set leftvalue to value.\n\nTo read right at spot (a whole number). If spot is more than lastsecond, return. Set current to item spot of seconds. Set value to 0. Parse segment. Set rightvalue to value.\n\nThe first is \"1.01\". The second is \"1.001\". The firstparts is split first by \".\". The secondparts is split second by \".\".\nFor each part in firstparts.\nPlace part into firsts.\n\nFor each part in secondparts.\nPlace part into seconds.\n\nThe endfirst is the last position of firsts. The endsecond is the last position of seconds. Set lastfirst to endfirst. Set lastsecond to endsecond. The result is 0.\nFor every spot from 0 to 2.\nSet leftvalue to 0. Set rightvalue to 0. If spot is at most lastfirst, read left at spot. If spot is at most lastsecond, read right at spot. If result is 0 and leftvalue is less than rightvalue, set result to -1. If result is 0 and leftvalue is more than rightvalue, set result to 1.\n\nShow result.\n","expected":"0\n","step_budget":2000000},{"id":166,"slug":"fraction-to-recurring-decimal","title":"Fraction to Recurring Decimal","difficulty":"Medium","category":"String","code":"Keep a shared seen as an empty list of whole numbers. Keep a shared digits as an empty list of text. Keep a shared foundat of 0.\nTo find from spot (a whole number) with target (a whole number). If spot is more than the last position of seen, return. If item spot of seen is target, set foundat to spot, return. Find from spot plus 1 with target.\n\nThe numerator is 1. The denominator is 6. The sign is 1. If numerator is less than 0, set sign to -1. The top is numerator times sign. The bottom is denominator. The whole is top divided by bottom. The remainder is top modulo bottom. The result is format whole number whole as text. If sign is -1, The mark is empty text, Place \"-\" into mark, Place mark into result. The cycle is -1. If remainder is more than 0, Place \".\" into result.\nRepeat while remainder is more than 0.\nSet foundat to -1. Find from 0 with remainder. If foundat is at least 0, set cycle to foundat, break. Place remainder into seen. The digit is remainder times 10 divided by bottom. The piece is format whole number digit as text. Place piece into digits. Set remainder to remainder times 10 modulo bottom.\n\nThe lastdigit is the last position of digits.\nFor every spot from 0 to lastdigit.\nIf spot is cycle, Place \"(\" into result. Place item spot of digits into result.\n\nIf cycle is at least 0, Place \")\" into result. Show result.\n","expected":"0.1(6)\n","step_budget":2000000},{"id":167,"slug":"two-sum-ii-input-array-is-sorted","title":"Two Sum II - Input Array Is Sorted","difficulty":"Medium","category":"Array","code":"The numbers is a list of 2, 7, 11, and 15. The target is 9. The left is 0. The right is 3. The answers is an empty list of whole numbers.\nRepeat while left is less than right.\nThe sum is item left of numbers plus item right of numbers. If sum is target, Place left plus 1 into answers, Place right plus 1 into answers, break. If sum is less than target, add 1 to left. If sum is more than target, subtract 1 from right.\n\nFor each answer in answers, show answer.\n","expected":"1\n2\n","step_budget":2000000},{"id":168,"slug":"excel-sheet-column-title","title":"Excel Sheet Column Title","difficulty":"Easy","category":"String","code":"The value is 28. The alphabet is \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\". The reversed is empty text.\nRepeat while value is more than 0.\nSubtract 1 from value. The digit is value modulo 26. Place character digit of alphabet into reversed. Set value to value divided by 26.\n\nThe last is the last position of reversed. The result is empty text.\nFor every step from 0 to last.\nThe source is last minus step. Place character source of reversed into result.\n\nShow result.\n","expected":"AB\n","step_budget":2000000},{"id":169,"slug":"majority-element","title":"Majority Element","difficulty":"Easy","category":"Array","code":"The numbers is a list of 2, 2, 1, 1, 1, 2, and 2. The candidate is item 0 of numbers. The score is 0.\nFor each value in numbers.\nIf score is 0, set candidate to value. If value is candidate, add 1 to score. If value is not candidate, subtract 1 from score.\n\nShow candidate.\n","expected":"2\n","step_budget":2000000},{"id":171,"slug":"excel-sheet-column-number","title":"Excel Sheet Column Number","difficulty":"Easy","category":"String","code":"Keep a shared alphabet as empty text. Keep a shared foundat of 0. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into alphabet.\nTo locate from spot (a whole number) with symbol (a whole number). If spot is more than 25, return. If symbol is character spot of alphabet, set foundat to spot, return. Locate from spot plus 1 with symbol.\n\nThe name is \"AB\". The last is the last position of name. The value is 0.\nFor every spot from 0 to last.\nSet foundat to -1. Locate from 0 with character spot of name. Set value to value times 26 plus foundat plus 1.\n\nShow value.\n","expected":"28\n","step_budget":2000000},{"id":172,"slug":"factorial-trailing-zeroes","title":"Factorial Trailing Zeroes","difficulty":"Medium","category":"Math","code":"The number is 25. The value is number. The count is 0.\nRepeat while value is more than 0.\nSet value to value divided by 5. Add value to count.\n\nShow count.\n","expected":"6\n","step_budget":2000000},{"id":174,"slug":"dungeon-game","title":"Dungeon Game","difficulty":"Hard","category":"Array","code":"The dungeon is a list of -2, -3, 3, -5, -10, 1, 10, 30, and -5. The rows is a list of 2, 2, 2, 1, 1, 1, 0, 0, and 0. The columns is a list of 2, 1, 0, 2, 1, 0, 2, 1, and 0. The health is a list of 9 zeros.\nFor every step from 0 to 8.\nThe row is item step of rows. The column is item step of columns. The index is row times 3 plus column. The need is 1000000. If row is less than 2, set need to item (index plus 3) of health. If column is less than 2 and item (index plus 1) of health is less than need, set need to item (index plus 1) of health. If row is 2 and column is 2, set need to 1. The here is need minus item index of dungeon. If here is less than 1, set here to 1. Set item index of health to here.\n\nShow item 0 of health.\n","expected":"7\n","step_budget":2000000},{"id":179,"slug":"largest-number","title":"Largest Number","difficulty":"Medium","category":"Array","code":"Keep a shared parts as an empty list of text. Keep a shared keytext as empty text. Keep a shared front as empty text. Keep a shared back as empty text. The numbers is a list of 3, 30, 34, 5, and 9.\nFor each number in numbers.\nThe piece is format whole number number as text. Place piece into parts.\n\nTo shift from spot (a whole number) with marker (a whole number). If spot is less than 0, set item 0 of parts to keytext, return. The other is item spot of parts. Set front to empty text. Place other into front. Place keytext into front. Set back to empty text. Place keytext into back. Place other into back. If front comes before back, set item (spot plus 1) of parts to other, shift from spot minus 1 with marker, return. Set item (spot plus 1) of parts to keytext.\n\nThe last is 4.\nFor every spot from 1 to last.\nSet keytext to item spot of parts. Shift from spot minus 1 with 0.\n\nThe result is join parts with \"\". Show result.\n","expected":"9534330\n","step_budget":2000000},{"id":187,"slug":"repeated-dna-sequences","title":"Repeated DNA Sequences","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Keep a shared windows as an empty list of text. Keep a shared target as empty text. Keep a shared tally of 0. Keep a shared already of 0. Keep a shared limit of 0. Place \"AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT\" into source.\nTo count from spot (a whole number) with word (a whole number). If spot is more than the last position of windows, return. If item spot of windows matches target, add 1 to tally. Count from spot plus 1 with word.\n\nTo earlier from spot (a whole number) with word (a whole number). If spot is more than limit, return. If item spot of windows matches target, set already to 1, return. Earlier from spot plus 1 with word.\n\nThe last is 30. The finishstart is last minus 9.\nFor every start from 0 to finishstart.\nThe finish is start plus 10. The piece is the slice of source from start to finish. Place piece into windows.\n\nThe lastwindow is the last position of windows.\nFor every spot from 0 to lastwindow.\nSet target to item spot of windows. Set tally to 0. Set already to 0. Set limit to spot minus 1. Count from 0 with 0. Earlier from 0 with 0. If tally is more than 1 and already is 0, show target.\n","expected":"AAAAACCCCC\nCCCCCAAAAA\n","step_budget":2000000},{"id":188,"slug":"best-time-to-buy-and-sell-stock-iv","title":"Best Time to Buy and Sell Stock IV","difficulty":"Hard","category":"Array","code":"Keep a shared buy as an empty list of whole numbers. Keep a shared sell as an empty list of whole numbers. Keep a shared deals of 2.\nFor every spot from 0 to 2.\nPlace 0 into buy. Place 0 into sell.\n\nSet item 1 of buy to -1000000. Set item 2 of buy to -1000000.\nTo revise from deal (a whole number) with price (a whole number). If deal is more than deals, return. The trial is item (deal minus 1) of sell minus price. If trial is more than item deal of buy, set item deal of buy to trial. The trial is item deal of buy plus price. If trial is more than item deal of sell, set item deal of sell to trial. Revise from deal plus 1 with price.\n\nThe prices is a list of 3, 2, 6, 5, 0, and 3.\nFor each price in prices.\nRevise from 1 with price.\n\nThe lastdeal is deals. Show item lastdeal of sell.\n","expected":"7\n","step_budget":2000000},{"id":189,"slug":"rotate-array","title":"Rotate Array","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 2, 3, 4, 5, 6, and 7. The size is 7. The turn is 3. The offset is turn modulo size. The result is an empty list of whole numbers.\nFor every spot from 0 to 6.\nThe source is spot plus size minus offset. If source is at least size, set source to source minus size. Place item source of numbers into result.\n\nFor each value in result, show value.\n","expected":"5\n6\n7\n1\n2\n3\n4\n","step_budget":2000000},{"id":190,"slug":"reverse-bits","title":"Reverse Bits","difficulty":"Easy","category":"Bit Manipulation","code":"The number is 43261596. The value is number. The result is 0.\nFor every step from 1 to 32.\nThe bit is bitwise and of value and 1. Set result to shift result left by 1. Set result to bitwise or of result and bit. Set value to shift value right by 1.\n\nShow result.\n","expected":"964176192\n","step_budget":2000000},{"id":191,"slug":"number-of-1-bits","title":"Number of 1 Bits","difficulty":"Easy","category":"Bit Manipulation","code":"The number is 11. The value is number. The count is 0.\nRepeat while value is more than 0.\nThe bit is bitwise and of value and 1. Add bit to count. Set value to shift value right by 1.\n\nShow count.\n","expected":"3\n","step_budget":2000000},{"id":198,"slug":"house-robber","title":"House Robber","difficulty":"Medium","category":"Array","code":"The houses is a list of 1, 2, 3, and 1. The before is 0. The recent is 0.\nFor each value in houses.\nThe current is recent. The offered is before plus value. If offered is more than current, set current to offered. Set before to recent. Set recent to current.\n\nShow recent.\n","expected":"4\n","step_budget":2000000},{"id":199,"slug":"binary-tree-right-side-view","title":"Binary Tree Right Side View","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, -1, 5, -1, and 4. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1.\n\nThe queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The remaining is 1. The nextcount is 0.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. If item node of lefts is at least 0, Place item node of lefts into queue, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. If remaining is 0, show item node of values, set remaining to nextcount, set nextcount to 0.\n","expected":"1\n3\n4\n","step_budget":2000000},{"id":200,"slug":"number-of-islands","title":"Number of Islands","difficulty":"Medium","category":"Array","code":"The chart is a list of 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, and 0. Keep a shared land as an empty list of whole numbers.\nFor each square in chart.\nPlace square into land.\n\nKeep a shared visited as an empty list of whole numbers.\nFor every spot from 0 to 19.\nPlace 0 into visited.\n\nTo walk from node (a whole number). If item node of land is 0, return. If item node of visited is 1, return. Set item node of visited to 1. The row is node divided by 5. The column is node modulo 5. If row is more than 0, walk from node minus 5. If row is less than 3, walk from node plus 5. If column is more than 0, walk from node minus 1. If column is less than 4, walk from node plus 1.\n\nThe islands is 0.\nFor every node from 0 to 19.\nIf item node of land is 1 and item node of visited is 0, add 1 to islands. If item node of land is 1 and item node of visited is 0, walk from node.\n\nShow islands.\n","expected":"1\n","step_budget":2000000},{"id":201,"slug":"bitwise-and-of-numbers-range","title":"Bitwise AND of Numbers Range","difficulty":"Medium","category":"Bit Manipulation","code":"The left is 5. The right is 7. The result is left.\nFor every value from left plus 1 to right.\nSet result to bitwise and of result and value.\n\nShow result.\n","expected":"4\n","step_budget":2000000},{"id":202,"slug":"happy-number","title":"Happy Number","difficulty":"Easy","category":"Math","code":"Keep a shared value of 0. Keep a shared total of 0.\nTo digitize. Set total to 0.\nRepeat while value is more than 0.\nThe digit is value modulo 10. Increase total by digit times digit. Set value to value divided by 10.\n\nThe start is 19. Set value to start. The steps is 0.\nRepeat while value is more than 1 and steps is less than 100.\nDigitize. Set value to total. Add 1 to steps.\n\nIf value is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":203,"slug":"remove-linked-list-elements","title":"Remove Linked List Elements","difficulty":"Easy","category":"Linked List","code":"The nodes is a list of 1, 2, 6, 3, 4, 5, and 6. The target is 6. The kept is an empty list of whole numbers.\nFor each value in nodes.\nIf value is not target, Place value into kept.\n\nFor each value in kept, show value.\n","expected":"1\n2\n3\n4\n5\n","step_budget":2000000},{"id":204,"slug":"count-primes","title":"Count Primes","difficulty":"Medium","category":"Array","code":"The flags is a list of 10 zeros.\nFor every spot from 0 to 9.\nSet item spot of flags to 1.\n\nSet item 0 of flags to 0. Set item 1 of flags to 0.\nFor every base from 2 to 9.\nIf item base of flags is 1.\nThe multiple is base times base.\nRepeat while multiple is less than 10.\nSet item multiple of flags to 0. Increase multiple by base.\n\nThe count is 0.\nFor every spot from 2 to 9.\nIf item spot of flags is 1, add 1 to count.\n\nShow count.\n","expected":"4\n","step_budget":2000000},{"id":205,"slug":"isomorphic-strings","title":"Isomorphic Strings","difficulty":"Easy","category":"String","code":"Keep a shared source as empty text. Keep a shared targetcode of 0. Keep a shared located of 0.\nTo locate from spot (a whole number). If spot is more than the last position of source, return. If character spot of source is targetcode, set located to spot, return. Locate from spot plus 1.\n\nThe first is \"egg\". The second is \"add\". The copyfirst is a copy of first. The copysecond is a copy of second. The last is the last position of first. The valid is 1. Set source to copyfirst.\nFor every spot from 0 to last.\nSet source to copyfirst. Set targetcode to character spot of first. Set located to -1. Locate from 0. The leftindex is located. Set source to copysecond. Set targetcode to character spot of second. Set located to -1. Locate from 0. The rightindex is located. If leftindex is not rightindex, set valid to 0.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":206,"slug":"reverse-linked-list","title":"Reverse Linked List","difficulty":"Easy","category":"Linked List","code":"The nodes is a list of 1, 2, 3, 4, and 5. The last is the last position of nodes.\nFor every step from 0 to last.\nThe spot is last minus step. Show item spot of nodes.\n","expected":"5\n4\n3\n2\n1\n","step_budget":2000000},{"id":207,"slug":"course-schedule","title":"Course Schedule","difficulty":"Medium","category":"Depth-First Search","code":"The size is 2. The edges is a list of 1 and 0. The pairs is 1. The adjacency is a list of 4 zeros. The indegree is a list of 2 zeros.\nFor every edge from 0 to pairs minus 1.\nThe target is item (edge times 2) of edges. The origin is item (edge times 2 plus 1) of edges. Set item (origin times size plus target) of adjacency to 1. Increase item target of indegree by 1.\n\nThe queue is an empty list of whole numbers. The count is 0. The head is 0.\nFor every node from 0 to size minus 1.\nIf item node of indegree is 0, Place node into queue, add 1 to count.\n\nThe seen is 0.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Add 1 to seen.\nFor every next from 0 to size minus 1.\nIf item (node times size plus next) of adjacency is 1.\nDecrease item next of indegree by 1. If item next of indegree is 0, Place next into queue, add 1 to count.\n\nIf seen is size, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":209,"slug":"minimum-size-subarray-sum","title":"Minimum Size Subarray Sum","difficulty":"Medium","category":"Array","code":"The target is 7. The numbers is a list of 2, 3, 1, 2, 4, and 3. The last is the last position of numbers. The best is 1000000.\nFor every start from 0 to last.\nThe total is 0.\nFor every finish from start to last.\nIncrease total by item finish of numbers.\nIf total is at least target.\nThe length is finish minus start plus 1. If length is less than best, set best to length. Break.\n\nIf best is 1000000, set best to 0. Show best.\n","expected":"2\n","step_budget":2000000},{"id":210,"slug":"course-schedule-ii","title":"Course Schedule II","difficulty":"Medium","category":"Depth-First Search","code":"The size is 4. The edges is a list of 1, 0, 2, 0, 3, 1, 3, and 2. The pairs is 4. The adjacency is a list of 16 zeros. The indegree is a list of 4 zeros.\nFor every edge from 0 to pairs minus 1.\nThe target is item (edge times 2) of edges. The origin is item (edge times 2 plus 1) of edges. Set item (origin times size plus target) of adjacency to 1. Increase item target of indegree by 1.\n\nThe queue is an empty list of whole numbers. The count is 0. The head is 0.\nFor every node from 0 to size minus 1.\nIf item node of indegree is 0, Place node into queue, add 1 to count.\n\nThe order is an empty list of whole numbers.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Place node into order.\nFor every next from 0 to size minus 1.\nIf item (node times size plus next) of adjacency is 1.\nDecrease item next of indegree by 1. If item next of indegree is 0, Place next into queue, add 1 to count.\n\nFor each value in order, show value.\n","expected":"0\n1\n2\n3\n","step_budget":2000000},{"id":212,"slug":"word-search-ii","title":"Word Search II","difficulty":"Hard","category":"Array","code":"Keep a shared grid as empty text. Keep a shared current as empty text. Keep a shared visited as an empty list of whole numbers. Keep a shared found of 0. Keep a shared limit of 0.\nTo wipe from spot (a whole number). If spot is more than 15, return. Set item spot of visited to 0. Wipe from spot plus 1.\n\nTo search from row (a whole number) at column (a whole number) with index (a whole number). If found is 1, return. If row is less than 0 or row is more than 3 or column is less than 0 or column is more than 3, return. The node is row times 4 plus column. If item node of visited is 1, return. If character node of grid is not character index of current, return. If index is limit, set found to 1, return. Set item node of visited to 1. If found is 0, search from row plus 1 at column with index plus 1. If found is 0, search from row minus 1 at column with index plus 1. If found is 0, search from row at column plus 1 with index plus 1. If found is 0, search from row at column minus 1 with index plus 1. Set item node of visited to 0.\n\nTo seek from node (a whole number). If node is more than 15, return. If found is 1, return. The row is node divided by 4. The column is node modulo 4. Search from row at column with 0. Seek from node plus 1.\n\nThe board is \"oaanetaeihkriflv\". The gridcopy is a copy of board. Set grid to gridcopy. The words is \"oath,pea,eat,rain\". The items is split words by \",\". The answers is an empty list of text.\nFor every spot from 0 to 15.\nPlace 0 into visited.\n\nFor each word in items.\nThe copy is a copy of word. Set current to copy. The final is the last position of current. Set limit to final. Set found to 0. Wipe from 0. Seek from 0. If found is 1, Place copy into answers.\n\nThe total is the number of items in answers. The last is total minus 1.\nFor every left from 0 to last.\nFor every right from left to last.\nIf item right of answers comes before item left of answers, swap item left of answers and item right of answers.\n\nFor each answer in answers, show answer.\n","expected":"eat\noath\n","step_budget":2000000},{"id":213,"slug":"house-robber-ii","title":"House Robber II","difficulty":"Medium","category":"Array","code":"The nums is a list of 2, 3, and 2. Keep a shared houses as an empty list of whole numbers.\nFor each value in nums.\nPlace value into houses.\n\nKeep a shared take of 0. Keep a shared skip of 0. Keep a shared best of 0.\nTo rob from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The current is skip. The offered is take plus item spot of houses. If offered is more than current, set current to offered. Set take to skip. Set skip to current. Rob from spot plus 1 with finish.\n\nSet best to 0. Set take to 0. Set skip to 0. Rob from 0 with 1. Set best to skip. Set take to 0. Set skip to 0. Rob from 1 with 2. If skip is more than best, set best to skip.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":214,"slug":"shortest-palindrome","title":"Shortest Palindrome","difficulty":"Hard","category":"String","code":"Keep a shared word as empty text. Keep a shared pal of 0.\nTo test from left (a whole number) with right (a whole number). If left is at least right, return. If character left of word is not character right of word, set pal to 0, return. Test from left plus 1 with right minus 1.\n\nThe source is \"aacecaaa\". The copy is a copy of source. Set word to copy. The last is the last position of source. The best is 1.\nFor every step from 0 to last.\nThe length is last plus 1 minus step. The right is length minus 1. Set pal to 1. Test from 0 with right. If pal is 1, set best to length, break.\n\nThe front is empty text. The count is last plus 1 minus best.\nFor every step from 0 to count minus 1.\nThe spot is last minus step. Place character spot of source into front.\n\nThe result is a copy of front.\nFor every spot from 0 to last.\nPlace character spot of source into result.\n\nShow result.\n","expected":"aaacecaaa\n","step_budget":2000000},{"id":215,"slug":"kth-largest-element-in-an-array","title":"Kth Largest Element in an Array","difficulty":"Medium","category":"Array","code":"The numbers is a list of 3, 2, 1, 5, 6, and 4. The rank is 2. The last is the last position of numbers.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nIf item right of numbers is more than item left of numbers, swap item left of numbers and item right of numbers.\n\nThe spot is rank minus 1. Show item spot of numbers.\n","expected":"5\n","step_budget":2000000},{"id":216,"slug":"combination-sum-iii","title":"Combination Sum III","difficulty":"Medium","category":"Array","code":"Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared choose of 0. Keep a shared target of 0. Set choose to 3. Set target to 7.\nTo shape from start (a whole number) at depth (a whole number) with total (a whole number). If depth is choose and total is target, The built is join parts with \",\", Place built into answers, return. If depth is choose, return. If total is more than target, return.\nFor every value from start to 9.\nIf total plus value is at most target.\nThe piece is format whole number value as text. Place piece into parts. Shape from value plus 1 at depth plus 1 with total plus value. Remove the last item from parts.\n\nShape from 1 at 0 with 0. For each answer in answers, show answer.\n","expected":"1,2,4\n","step_budget":2000000},{"id":217,"slug":"contains-duplicate","title":"Contains Duplicate","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 2, 3, and 1. The last is the last position of numbers. The found is 0.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nIf item left of numbers is item right of numbers, set found to 1.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":218,"slug":"the-skyline-problem","title":"The Skyline Problem","difficulty":"Hard","category":"Array","code":"The lefts is a list of 2, 3, 5, 15, and 19. The rights is a list of 9, 7, 12, 20, and 24. The highs is a list of 10, 15, 12, 10, and 8. The sky is a list of 25 zeros. The total is 5.\nFor every building from 0 to total minus 1.\nThe left is item building of lefts. The right is item building of rights. The high is item building of highs.\nFor every spot from left to right minus 1.\nIf item spot of sky is less than high, set item spot of sky to high.\n\nThe previous is 0.\nFor every spot from 0 to 24.\nThe current is item spot of sky. If current is not previous, Report spot, Report current, Report \"---\", set previous to current.\n","expected":"2\n10\n---\n3\n15\n---\n7\n12\n---\n12\n0\n---\n15\n10\n---\n20\n8\n---\n24\n0\n---\n","step_budget":2000000},{"id":219,"slug":"contains-duplicate-ii","title":"Contains Duplicate II","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 2, 3, and 1. The distance is 3. The last is the last position of numbers. The found is 0.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nThe gap is right minus left. If gap is at most distance and item left of numbers is item right of numbers, set found to 1.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":220,"slug":"contains-duplicate-iii","title":"Contains Duplicate III","difficulty":"Hard","category":"Array","code":"The numbers is a list of 1, 2, 3, and 1. The indexgap is 3. The valuegap is 0. The last is the last position of numbers. The found is 0.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nThe gap is right minus left. The difference is item left of numbers minus item right of numbers. If difference is less than 0, set difference to 0 minus difference. If gap is at most indexgap and difference is at most valuegap, set found to 1.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":221,"slug":"maximal-square","title":"Maximal Square","difficulty":"Medium","category":"Array","code":"The grid is a list of 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, and 0. The dp is a list of 20 zeros. The best is 0.\nFor every node from 0 to 19.\nThe row is node divided by 5. The column is node modulo 5.\nIf item node of grid is 1.\nSet item node of dp to 1. If item node of dp is more than best, set best to item node of dp.\nIf row is more than 0 and column is more than 0.\nThe above is item (node minus 5) of dp. The left is item (node minus 1) of dp. The corner is item (node minus 6) of dp. The small is above. If left is less than small, set small to left. If corner is less than small, set small to corner. Set item node of dp to small plus 1. If item node of dp is more than best, set best to item node of dp.\n\nThe area is best times best. Show area.\n","expected":"4\n","step_budget":2000000},{"id":222,"slug":"count-complete-tree-nodes","title":"Count Complete Tree Nodes","difficulty":"Medium","category":"Binary Search","code":"Keep a shared values holding 1, 2, 3, 4, 5, and 6. Keep a shared lefts holding 1, 3, 5, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, -1, and -1. Keep a shared total of 0.\nTo gather from node (a whole number). If node is less than 0, return. Add 1 to total. Gather from item node of lefts. Gather from item node of rights.\n\nGather from 0. Show total.\n","expected":"6\n","step_budget":2000000},{"id":223,"slug":"rectangle-area","title":"Rectangle Area","difficulty":"Medium","category":"Math","code":"The axone is -3. The ayone is 0. The axtwo is 3. The aytwo is 4. The bxone is 0. The byone is -1. The bxtwo is 9. The bytwo is 2. The awidth is axtwo minus axone. The aheight is aytwo minus ayone. The barea is awidth times aheight. The bwidth is bxtwo minus bxone. The bheight is bytwo minus byone. The bcarea is bwidth times bheight. The leftedge is axone. If bxone is more than leftedge, set leftedge to bxone. The rightedge is axtwo. If bxtwo is less than rightedge, set rightedge to bxtwo. The bottomedge is ayone. If byone is more than bottomedge, set bottomedge to byone. The topedge is aytwo. If bytwo is less than topedge, set topedge to bytwo. The overlapwidth is rightedge minus leftedge. The overlapheight is topedge minus bottomedge. The total is barea plus bcarea. If overlapwidth is more than 0 and overlapheight is more than 0, The overlaparea is overlapwidth times overlapheight, set total to total minus overlaparea.\n\nShow total.\n","expected":"45\n","step_budget":2000000},{"id":224,"slug":"basic-calculator","title":"Basic Calculator","difficulty":"Hard","category":"String","code":"The source is \"(1+(4+5+2)-3)+(6+8)\". Keep a shared stack as an empty list of whole numbers. Keep a shared total of 0. Keep a shared polarity of 1. Keep a shared number of 0. Keep a shared depth of 0.\nTo close. Increase total by polarity times number. Set number to 0. The savedpolarity is item (depth minus 1) of stack. remove the last item from stack. Decrease depth by 1. The savedtotal is item (depth minus 1) of stack. remove the last item from stack. Decrease depth by 1. Set total to savedtotal plus savedpolarity times total. Set polarity to 1.\n\nThe last is the last position of source.\nFor every spot from 0 to last.\nThe symbol is character spot of source. If symbol is between \"0\" and \"9\", The digit is the digit value of symbol, set number to number times 10 plus digit. If symbol is \"+\", set total to total plus polarity times number, set number to 0, set polarity to 1. If symbol is \"-\", set total to total plus polarity times number, set number to 0, set polarity to 0 minus 1. If symbol is \"(\", Place total into stack, Place polarity into stack, add 2 to depth, set total to 0, set polarity to 1. If symbol is \")\", close.\n\nIncrease total by polarity times number. Show total.\n","expected":"23\n","step_budget":2000000},{"id":226,"slug":"invert-binary-tree","title":"Invert Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 4, 2, 7, 1, 3, 6, and 9. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1.\nTo mirror from node (a whole number). If node is less than 0, return. The saved is item node of lefts. Set item node of lefts to item node of rights. Set item node of rights to saved. Mirror from item node of lefts. Mirror from item node of rights.\n\nMirror from 0. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Show item node of values. The left is item node of lefts. The right is item node of rights. If left is at least 0, Place left into queue, add 1 to count. If right is at least 0, Place right into queue, add 1 to count.\n","expected":"4\n7\n2\n9\n6\n3\n1\n","step_budget":2000000},{"id":227,"slug":"basic-calculator-ii","title":"Basic Calculator II","difficulty":"Medium","category":"String","code":"The source is \"3+2*2\". Keep a shared stack as an empty list of whole numbers. Keep a shared number of 0. Keep a shared lastcode of 1. Keep a shared depth of 0. Keep a shared total of 0.\nTo multiply. The top is item (depth minus 1) of stack. remove the last item from stack. Decrease depth by 1. The product is top times number. Place product into stack. Add 1 to depth. Set number to 0.\n\nTo divide. The top is item (depth minus 1) of stack. remove the last item from stack. Decrease depth by 1. The quotient is top divided by number. Place quotient into stack. Add 1 to depth. Set number to 0.\n\nTo settle. If lastcode is 1, Place number into stack, add 1 to depth, set number to 0. If lastcode is 2, The neg is 0 minus number, Place neg into stack, add 1 to depth, set number to 0. If lastcode is 3, multiply. If lastcode is 4, divide.\n\nThe last is the last position of source.\nFor every spot from 0 to last.\nThe symbol is character spot of source. If symbol is between \"0\" and \"9\", The digit is the digit value of symbol, set number to number times 10 plus digit. If symbol is \"+\", settle, set lastcode to 1. If symbol is \"-\", settle, set lastcode to 2. If symbol is \"*\", settle, set lastcode to 3. If symbol is \"/\", settle, set lastcode to 4.\n\nSettle. For each value in stack, add value to total.\n\nShow total.\n","expected":"7\n","step_budget":2000000},{"id":228,"slug":"summary-ranges","title":"Summary Ranges","difficulty":"Easy","category":"Array","code":"Keep a shared numbers holding 0, 1, 2, 4, 5, and 7. Keep a shared last of 5. Keep a shared beginslot of 0. Keep a shared finishslot of 0. Keep a shared line as empty text. Keep a shared answers as an empty list of text.\nTo store. Set line to empty text. The firstlocal is beginslot. The beginvalue is item firstlocal of numbers. The begintext is format whole number beginvalue as text. Place begintext into line. The secondlocal is finishslot. The endvalue is item secondlocal of numbers. The endtext is format whole number endvalue as text. If beginslot is not finishslot, Place \"->\" into line, Place endtext into line. The copy is a copy of line. Place copy into answers.\n\nFor every spot from 0 to last.\nThe current is item spot of numbers. If spot is 0, set beginslot to spot. If spot is more than 0, The previous is item (spot minus 1) of numbers, If current is not previous plus 1, set beginslot to spot. If spot is last, set finishslot to spot, store. If spot is less than last, The next is item (spot plus 1) of numbers, If next is not current plus 1, set finishslot to spot, store.\n\nFor each answer in answers, show answer.\n","expected":"0->2\n4->5\n7\n","step_budget":2000000},{"id":229,"slug":"majority-element-ii","title":"Majority Element II","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 3, 2, and 3. Keep a shared last of 2. Keep a shared count of 0. Keep a shared duplicate of 0.\nTo tally from target (a whole number). Set count to 0.\nFor every other from 0 to last.\nIf item other of numbers is item target of numbers, add 1 to count.\n\nTo check from target (a whole number). Set duplicate to 0.\nFor every prior from 0 to last.\nIf prior is less than target and item prior of numbers is item target of numbers, set duplicate to 1.\n\nFor every spot from 0 to last.\nTally from spot. Check from spot. If count times 3 is more than 3 and duplicate is 0, show item spot of numbers.\n","expected":"3\n","step_budget":2000000},{"id":230,"slug":"kth-smallest-element-in-a-bst","title":"Kth Smallest Element in a BST","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 3, 1, 4, and 2. Keep a shared lefts holding 1, -1, -1, and -1. Keep a shared rights holding 2, 3, -1, and -1. Keep a shared order as an empty list of whole numbers.\nTo gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Place item node of values into order. Gather from item node of rights.\n\nGather from 0. The place is 0. Show item place of order.\n","expected":"1\n","step_budget":2000000},{"id":231,"slug":"power-of-two","title":"Power of Two","difficulty":"Easy","category":"Math","code":"The number is 16. The value is 16. The answer is 0. If value is more than 0, set answer to 1.\nRepeat while value is more than 1.\nThe remainder is value modulo 2. If remainder is not 0, set answer to 0. Set value to value divided by 2.\n\nIf answer is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":233,"slug":"number-of-digit-one","title":"Number of Digit One","difficulty":"Hard","category":"Math","code":"The limit is 13. Keep a shared total of 0.\nFor every number from 1 to limit.\nThe value is number.\nRepeat while value is more than 0.\nThe digit is value modulo 10. If digit is 1, add 1 to total. Set value to value divided by 10.\n\nShow total.\n","expected":"6\n","step_budget":2000000},{"id":234,"slug":"palindrome-linked-list","title":"Palindrome Linked List","difficulty":"Easy","category":"Stack","code":"The numbers is a list of 1, 2, 2, and 1. The left is 0. The right is the last position of numbers. The answer is 1.\nRepeat while left is less than right.\nIf item left of numbers is not item right of numbers, set answer to 0. Add 1 to left. Decrease right by 1.\n\nIf answer is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":235,"slug":"lowest-common-ancestor-of-a-binary-search-tree","title":"Lowest Common Ancestor of a Binary Search Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 6, 2, 8, 0, 4, 7, 9, 3, and 5. Keep a shared lefts holding 1, 3, 7, 9, -1, 5, 6, -1, and -1. Keep a shared rights holding 2, 4, 8, 10, -1, -1, -1, -1, and -1. The current is 0. The answer is 0. Set answer to -1.\nRepeat while answer is -1.\nThe here is item current of values. The left is item current of lefts. The right is item current of rights. If here is more than 8, set current to left. If here is less than 2, set current to right. If here is at least 2 and here is at most 8, set answer to here.\n\nShow answer.\n","expected":"6\n","step_budget":2000000},{"id":236,"slug":"lowest-common-ancestor-of-a-binary-tree","title":"Lowest Common Ancestor of a Binary Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 3, 5, 1, 6, 2, 0, 8, 7, and 4. Keep a shared lefts holding 1, 3, 5, -1, 7, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, 8, -1, -1, -1, and -1. The last is 8. The parents is a list of 9 zeros. Set item 0 of parents to -1. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The left is item node of lefts. The right is item node of rights. If left is at least 0, Place left into queue, add 1 to count, set item left of parents to node. If right is at least 0, Place right into queue, add 1 to count, set item right of parents to node.\n\nThe firstnode is 0. The secondnode is 0.\nFor every spot from 0 to last.\nIf item spot of values is 5, set firstnode to spot. If item spot of values is 1, set secondnode to spot.\n\nThe marks is a list of 9 zeros. The walker is firstnode.\nRepeat while walker is at least 0.\nSet item walker of marks to 1. Set walker to item walker of parents.\n\nThe seeker is secondnode.\nRepeat while item seeker of marks is 0.\nSet seeker to item seeker of parents.\n\nShow item seeker of values.\n","expected":"3\n","step_budget":2000000},{"id":237,"slug":"delete-node-in-a-linked-list","title":"Delete Node in a Linked List","difficulty":"Medium","category":"Linked List","code":"The numbers is a list of 4, 5, 1, and 9. The last is the last position of numbers. The target is 0. The found is 0.\nFor every spot from 0 to last.\nIf found is 0 and item spot of numbers is 5, set target to spot, set found to 1.\n\nThe head is target. The end is last minus 1.\nFor every spot from head to end.\nSet item spot of numbers to item (spot plus 1) of numbers.\n\nremove the last item from numbers. For each value in numbers, show value.\n","expected":"4\n1\n9\n","step_budget":2000000},{"id":238,"slug":"product-of-array-except-self","title":"Product of Array Except Self","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 2, 3, and 4. Keep a shared last of 3. Keep a shared product of 0.\nTo multiply from target (a whole number). Set product to 1.\nFor every other from 0 to last.\nIf other is not target, set product to product times item other of numbers.\n\nThe answer is an empty list of whole numbers.\nFor every slot from 0 to 3.\nPlace 0 into answer.\n\nFor every spot from 0 to last.\nMultiply from spot. Set item spot of answer to product.\n\nFor each value in answer, show value.\n","expected":"24\n12\n8\n6\n","step_budget":2000000},{"id":239,"slug":"sliding-window-maximum","title":"Sliding Window Maximum","difficulty":"Hard","category":"Array","code":"Keep a shared numbers holding 1, 3, -1, -3, 5, 3, 6, and 7. Keep a shared last of 7. Keep a shared best of 0.\nTo scan from target (a whole number) with width (a whole number). Set best to item target of numbers. The final is target plus width minus 1.\nFor every offset from target to final.\nThe value is item offset of numbers. If value is more than best, set best to value.\n\nThe limit is last minus 2.\nFor every start from 0 to limit.\nScan from start with 3. Show best.\n","expected":"3\n3\n5\n5\n6\n7\n","step_budget":2000000},{"id":240,"slug":"search-a-2d-matrix-ii","title":"Search a 2D Matrix II","difficulty":"Medium","category":"Array","code":"The matrix is a list of 1, 4, 7, 11, 15, 2, 5, 8, 12, 19, 3, 6, 9, 16, 22, 10, 13, 14, 17, 24, 18, 21, 23, 26, and 30. The target is 5. The row is 0. The column is 4. The found is 0.\nRepeat while row is less than 5 and column is at least 0 and found is 0.\nThe cell is row times 5 plus column. The value is item cell of matrix. If value is target, set found to 1. If value is more than target, set column to column minus 1. If value is less than target, set row to row plus 1.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":241,"slug":"different-ways-to-add-parentheses","title":"Different Ways to Add Parentheses","difficulty":"Medium","category":"String","code":"The expression is \"2-1-1\". Keep a shared numbers as an empty list of whole numbers. Keep a shared opercodes as an empty list of whole numbers. Keep a shared table as an empty list of whole numbers. Keep a shared counts as an empty list of whole numbers. Keep a shared capacity of 4. Keep a shared width of 3. The number is 0. The last is the last position of expression.\nFor every spot from 0 to last.\nThe symbol is character spot of expression. If symbol is between \"0\" and \"9\", The digit is the digit value of symbol, set number to number times 10 plus digit. If symbol is \"+\", Place number into numbers, Place 1 into opercodes, set number to 0. If symbol is \"-\", Place number into numbers, Place 2 into opercodes, set number to 0. If symbol is \"*\", Place number into numbers, Place 3 into opercodes, set number to 0.\n\nPlace number into numbers.\nFor every slot from 0 to 35.\nPlace 0 into table.\n\nFor every slot from 0 to 8.\nPlace 0 into counts.\n\nTo solve from start (a whole number) with finish (a whole number). The cell is start times width plus finish. If start is finish, set item cell of counts to 1, set item (cell times capacity) of table to item start of numbers, return. Set item cell of counts to 0. The splitlast is finish minus 1.\nFor every split from start to splitlast.\nSolve from start with split. Solve from split plus 1 with finish. The leftcell is start times width plus split. The rightcell is (split plus 1) times width plus finish. The leftcount is item leftcell of counts. The rightcount is item rightcell of counts. The oper is item split of opercodes. The leftlast is leftcount minus 1.\nFor every leftslot from 0 to leftlast.\nThe leftvalue is item (leftcell times capacity plus leftslot) of table. The rightlast is rightcount minus 1.\nFor every rightslot from 0 to rightlast.\nThe rightvalue is item (rightcell times capacity plus rightslot) of table. The value is 0. If oper is 1, set value to leftvalue plus rightvalue. If oper is 2, set value to leftvalue minus rightvalue. If oper is 3, set value to leftvalue times rightvalue. The slotindex is item cell of counts. The spot is cell times capacity plus slotindex. Set item spot of table to value. Set item cell of counts to slotindex plus 1.\n\nSolve from 0 with 2. The finalcell is 2. The total is item finalcell of counts. The answers is an empty list of whole numbers. The lastslot is total minus 1.\nFor every slot from 0 to lastslot.\nThe answer is item (finalcell times capacity plus slot) of table. Place answer into answers.\n\nSort answers. For each answer in answers, show answer.\n","expected":"0\n2\n","step_budget":2000000},{"id":242,"slug":"valid-anagram","title":"Valid Anagram","difficulty":"Easy","category":"String","code":"Keep a shared first as empty text. Place \"anagram\" into first. Keep a shared second as empty text. Place \"nagaram\" into second. Keep a shared last of 6. Keep a shared countfirst of 0. Keep a shared countsecond of 0. Keep a shared answer of 1.\nTo tally from target (a whole number). Set countfirst to 0. Set countsecond to 0.\nFor every other from 0 to last.\nThe leftletter is character other of first. The rightletter is character target of first. The otherletter is character other of second. If leftletter is rightletter, add 1 to countfirst. If otherletter is rightletter, add 1 to countsecond.\n\nFor every spot from 0 to last.\nTally from spot. If countfirst is not countsecond, set answer to 0.\n\nIf answer is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":257,"slug":"binary-tree-paths","title":"Binary Tree Paths","difficulty":"Easy","category":"String","code":"Keep a shared values holding 1, 2, 3, and 5. Keep a shared lefts holding 1, -1, -1, and -1. Keep a shared rights holding 2, 3, -1, and -1. Keep a shared path as an empty list of whole numbers. Keep a shared answers as an empty list of text. Keep a shared line as empty text.\n\nTo render from spot (a whole number) with last (a whole number). If spot is more than last, return. If spot is more than 0, Place \"->\" into line. The piece is format whole number item spot of path as text. Place piece into line. Render from spot plus 1 with last.\n\nTo store answer. Set line to empty text. The lastpath is the last position of path. Render from 0 with lastpath. The copy is a copy of line. Place copy into answers.\n\nTo walk from node (a whole number). If node is less than 0, return. Place item node of values into path. The left is item node of lefts. The right is item node of rights. If left is -1 and right is -1, store answer. If left is at least 0, walk from left. If right is at least 0, walk from right. Remove the last item from path.\n\nWalk from 0. For each answer in answers, show answer.\n","expected":"1->2->5\n1->3\n","step_budget":2000000},{"id":258,"slug":"add-digits","title":"Add Digits","difficulty":"Easy","category":"Math","code":"Keep a shared result of 0.\n\nTo gather from value (a whole number) with total (a whole number). If value is 0, set result to total, return. Gather from value divided by 10 with total plus value modulo 10.\n\nThe number is 38. The value is number.\nRepeat while value is at least 10.\nGather from value with 0. Set value to result.\n\nShow value.\n","expected":"2\n","step_budget":2000000},{"id":260,"slug":"single-number-iii","title":"Single Number III","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 2, 1, 3, 2, and 5. Keep a shared seek of 0. Keep a shared tally of 0. Keep a shared answers as an empty list of whole numbers.\n\nTo gather from spot (a whole number) with last (a whole number). If spot is more than last, return. If item spot of numbers is seek, add 1 to tally. Gather from spot plus 1 with last.\n\nFor every spot from 0 to 5.\nSet seek to item spot of numbers. Set tally to 0. Gather from 0 with 5. If tally is 1, Place seek into answers.\n\nSort answers. For each value in answers, show value.\n","expected":"3\n5\n","step_budget":2000000},{"id":263,"slug":"ugly-number","title":"Ugly Number","difficulty":"Easy","category":"Math","code":"The number is 6. The value is number.\nRepeat while value modulo 2 is 0.\nSet value to value divided by 2.\n\nRepeat while value modulo 3 is 0.\nSet value to value divided by 3.\n\nRepeat while value modulo 5 is 0.\nSet value to value divided by 5.\n\nIf value is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":264,"slug":"ugly-number-ii","title":"Ugly Number II","difficulty":"Medium","category":"Math","code":"Keep a shared ugly of 0.\n\nTo test from value (a whole number). If value is 1, set ugly to 1, return. If value modulo 2 is 0, test from value divided by 2, return. If value modulo 3 is 0, test from value divided by 3, return. If value modulo 5 is 0, test from value divided by 5, return.\n\nThe want is 10. The count is 0. The candidate is 0.\nRepeat while count is less than want.\nAdd 1 to candidate. Set ugly to 0. Test from candidate. If ugly is 1, add 1 to count.\n\nShow candidate.\n","expected":"12\n","step_budget":2000000},{"id":268,"slug":"missing-number","title":"Missing Number","difficulty":"Easy","category":"Array","code":"The numbers is a list of 3, 0, and 1. The last is the last position of numbers. The size is last plus 1. The total is 0.\nFor each value in numbers.\nAdd value to total.\n\nThe expected is size times (size plus 1) divided by 2. Show expected minus total.\n","expected":"2\n","step_budget":2000000},{"id":273,"slug":"integer-to-english-words","title":"Integer to English Words","difficulty":"Hard","category":"String","code":"Keep a shared ones holding \"Zero\", \"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\", \"Ten\", \"Eleven\", \"Twelve\", \"Thirteen\", \"Fourteen\", \"Fifteen\", \"Sixteen\", \"Seventeen\", \"Eighteen\", and \"Nineteen\". Keep a shared tens holding \"Twenty\", \"Thirty\", \"Forty\", \"Fifty\", \"Sixty\", \"Seventy\", \"Eighty\", and \"Ninety\". Keep a shared part as empty text.\n\nTo render from value (a whole number). The hundreds is value divided by 100. If value is at least 100, Place item hundreds of ones into part, Place \" Hundred\" into part. Set value to value modulo 100. If value is 0, return. If value is more than 0 and hundreds is more than 0, Place \" \" into part. If value is less than 20, Place item value of ones into part, return. The tensdigit is value divided by 10. Place item (tensdigit minus 2) of tens into part. The digit is value modulo 10. If digit is more than 0, Place \" \" into part, Place item digit of ones into part.\n\nThe number is 123. The value is number. The billions is value divided by 1000000000. If value is at least 1000000000, render from billions, Place \" Billion\" into part, set value to value modulo 1000000000. The millions is value divided by 1000000. If value is at least 1000000 and the length of part is more than 0, Place \" \" into part. If value is at least 1000000, render from millions, Place \" Million\" into part, set value to value modulo 1000000. The thousands is value divided by 1000. If value is at least 1000 and the length of part is more than 0, Place \" \" into part. If value is at least 1000, render from thousands, Place \" Thousand\" into part, set value to value modulo 1000. If value is more than 0 and the length of part is more than 0, Place \" \" into part. If value is more than 0, render from value. If number is 0, Place \"Zero\" into part.\n\nShow part.\n","expected":"One Hundred Twenty Three\n","step_budget":2000000},{"id":274,"slug":"h-index","title":"H-Index","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 3, 0, 6, 1, and 5. Keep a shared seek of 0. Keep a shared tally of 0.\n\nTo gather from spot (a whole number) with last (a whole number). If spot is more than last, return. If item spot of numbers is at least seek, add 1 to tally. Gather from spot plus 1 with last.\n\nThe best is 0.\nFor every level from 0 to 5.\nSet seek to level. Set tally to 0. Gather from 0 with 4. If tally is at least level, set best to level.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":275,"slug":"h-index-ii","title":"H-Index II","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 0, 1, 3, 5, and 6. Keep a shared seek of 0. Keep a shared tally of 0.\n\nTo gather from spot (a whole number) with last (a whole number). If spot is more than last, return. If item spot of numbers is at least seek, add 1 to tally. Gather from spot plus 1 with last.\n\nThe best is 0.\nFor every level from 0 to 4.\nSet seek to level. Set tally to 0. Gather from 0 with 4. If tally is at least level, set best to level.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":279,"slug":"perfect-squares","title":"Perfect Squares","difficulty":"Medium","category":"Math","code":"Keep a shared dp as an empty list of whole numbers.\nFor every spot from 0 to 12.\nPlace 0 into dp.\n\nKeep a shared best of 0.\n\nTo test from value (a whole number) with step (a whole number). The square is step times step. If square is more than value, return. The trial is item (value minus square) of dp plus 1. If trial is less than best, set best to trial. Test from value with step plus 1.\n\nThe number is 12.\nFor every value from 1 to 12.\nSet best to 1000000. Test from value with 1. Set item value of dp to best.\n\nShow item 12 of dp.\n","expected":"3\n","step_budget":2000000},{"id":282,"slug":"expression-add-operators","title":"Expression Add Operators","difficulty":"Hard","category":"String","code":"Keep a shared source as empty text. Place \"123\" into source. Keep a shared parts as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared target of 0. Keep a shared lastposition of 0. Keep a shared currenttotal of 0. Keep a shared lastoperand of 0. Keep a shared operand of 0. Keep a shared part as empty text.\n\nTo store answer. If currenttotal is not target, return. The expression is join parts with \"\". The copy is a copy of expression. Place copy into answers.\n\nTo extend from end (a whole number) with code (a whole number). The value is operand. The savetotal is currenttotal. The savelast is lastoperand. Set part to empty text. If code is 0, Place \"+\" into part. If code is 1, Place \"-\" into part. If code is 2, Place \"*\" into part. Place format whole number value as text into part. Place part into parts. If code is 0, set currenttotal to currenttotal plus value. If code is 1, set currenttotal to currenttotal minus value. If code is 2, set lastoperand to lastoperand times value. If code is 2, set currenttotal to currenttotal minus savelast plus lastoperand. Search from end. Set currenttotal to savetotal. Set lastoperand to savelast. Remove the last item from parts.\n\nTo search from start (a whole number). If start is more than lastposition, store answer, return. The value is 0.\nFor every end from start to lastposition.\nThe digit is the digit value of character end of source. Set value to value times 10 plus digit. If start is less than end and character start of source is \"0\", break. Set operand to value. If start is 0, carry from end. If start is not 0, set operand to value. If start is not 0, extend from end plus 1 with 0. If start is not 0, set operand to value. If start is not 0, extend from end plus 1 with 1. If start is not 0, set operand to value. If start is not 0, extend from end plus 1 with 2.\n\nTo carry from end (a whole number). The value is operand. The piece is format whole number value as text. Place piece into parts. Set currenttotal to value. Set lastoperand to value. Search from end plus 1. Remove the last item from parts.\n\nSet target to 6. Set lastposition to 2. Search from 0. For each answer in answers, show answer.\n","expected":"1+2+3\n1*2*3\n","step_budget":2000000},{"id":283,"slug":"move-zeroes","title":"Move Zeroes","difficulty":"Easy","category":"Array","code":"The numbers is a list of 0, 1, 0, 3, and 12. The result is an empty list of whole numbers. The zeros is 0.\nFor each value in numbers.\nIf value is not 0, Place value into result. If value is 0, add 1 to zeros.\n\nRepeat while zeros is more than 0.\nPlace 0 into result. Subtract 1 from zeros.\n\nFor each value in result, show value.\n","expected":"1\n3\n12\n0\n0\n","step_budget":2000000},{"id":287,"slug":"find-the-duplicate-number","title":"Find the Duplicate Number","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 3, 4, 2, and 2. Keep a shared seek of 0. Keep a shared tally of 0.\n\nTo gather from spot (a whole number) with last (a whole number). If spot is more than last, return. If item spot of numbers is seek, add 1 to tally. Gather from spot plus 1 with last.\n\nThe duplicate is 0.\nFor every spot from 0 to 4.\nSet seek to item spot of numbers. Set tally to 0. Gather from 0 with spot minus 1. If tally is more than 0, set duplicate to seek.\n\nShow duplicate.\n","expected":"2\n","step_budget":2000000},{"id":289,"slug":"game-of-life","title":"Game of Life","difficulty":"Medium","category":"Array","code":"Keep a shared board holding 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, and 0. Keep a shared rowsteps holding -1, -1, -1, 0, 0, 1, 1, and 1. Keep a shared colsteps holding -1, 0, 1, -1, 1, -1, 0, and 1. Keep a shared neighbors of 0.\n\nTo count from row (a whole number) with column (a whole number). Set neighbors to 0.\nFor every step from 0 to 7.\nThe r is row plus item step of rowsteps. The c is column plus item step of colsteps. If r is at least 0 and r is less than 4 and c is at least 0 and c is less than 3 and item (r times 3 plus c) of board is 1, add 1 to neighbors.\n\nThe future is a list of 12 zeros.\nFor every cell from 0 to 11.\nThe row is cell divided by 3. The column is cell modulo 3. Count from row with column. The live is item cell of board. The nextvalue is 0. If live is 1 and neighbors is at least 2 and neighbors is at most 3, set nextvalue to 1. If live is 1 and neighbors is less than 2, set nextvalue to 0. If live is 1 and neighbors is more than 3, set nextvalue to 0. If live is 0 and neighbors is 3, set nextvalue to 1. Set item cell of future to nextvalue.\n\nFor each value in future, show value.\n","expected":"0\n0\n0\n1\n0\n1\n0\n1\n1\n0\n1\n0\n","step_budget":2000000},{"id":290,"slug":"word-pattern","title":"Word Pattern","difficulty":"Easy","category":"String","code":"The pattern is \"abba\". The source is \"dog cat cat dog\". The pieces is split source by \" \". Keep a shared words as an empty list of text.\nFor each piece in pieces.\nPlace piece into words.\n\nKeep a shared keys as an empty list of text. Keep a shared values as an empty list of text. Keep a shared seek as empty text. Keep a shared found of 0. Keep a shared used of 0. Keep a shared same of 0. Keep a shared letter as empty text.\n\nTo locate from spot (a whole number) with last (a whole number). If spot is more than last, return. If item spot of keys matches letter, set found to spot, return. Locate from spot plus 1 with last.\n\nTo check from spot (a whole number). If item spot of values does not match seek, set same to 0.\n\nTo search from spot (a whole number) with last (a whole number). If spot is more than last, return. If item spot of values matches seek, set used to 1, return. Search from spot plus 1 with last.\n\nThe length is the number of characters in pattern. The count is the number of items in words. The good is 1. If length is not count, set good to 0.\nIf length is count.\nFor every spot from 0 to 3.\nThe symbol is character spot of pattern. Set letter to empty text. Place symbol into letter. Set seek to item spot of words. Set found to -1. The keylast is the last position of keys. Locate from 0 with keylast. Set same to 1. If found is at least 0, check from found. If found is at least 0 and same is 0, set good to 0. If found is -1, set used to 0. The valuelast is the last position of values. If found is -1, search from 0 with valuelast. If found is -1 and used is 1, set good to 0. If found is -1 and used is 0, Place letter into keys, Place seek into values.\n\nIf good is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":292,"slug":"nim-game","title":"Nim Game","difficulty":"Easy","category":"Math","code":"The stones is 4. The value is stones.\nRepeat while value is more than 0.\nDecrease value by 4.\n\nIf value is 0, show false, otherwise show true.\n","expected":"false\n","step_budget":2000000},{"id":299,"slug":"bulls-and-cows","title":"Bulls and Cows","difficulty":"Medium","category":"String","code":"Keep a shared secret as empty text. Place \"1807\" into secret. Keep a shared guess as empty text. Place \"7810\" into guess. Keep a shared usedsecret as an empty list of whole numbers. Keep a shared usedguess as an empty list of whole numbers.\nFor every spot from 0 to 3.\nPlace 0 into usedsecret. Place 0 into usedguess.\n\nKeep a shared bulls of 0. Keep a shared cows of 0. Keep a shared targetchar of 0. Keep a shared cowfound of 0.\n\nFor every spot from 0 to 3.\nIf character spot of secret is character spot of guess, add 1 to bulls, set item spot of usedsecret to 1, set item spot of usedguess to 1.\n\nTo find from spot (a whole number) with last (a whole number). If spot is more than last, return. If item spot of usedguess is 1, find from spot plus 1 with last, return. If character spot of guess is targetchar, set item spot of usedguess to 1, set cowfound to 1, return. Find from spot plus 1 with last.\n\nFor every spot from 0 to 3.\nIf item spot of usedsecret is 0.\nSet targetchar to character spot of secret. Set cowfound to 0. Find from 0 with 3. If cowfound is 1, add 1 to cows, set item spot of usedsecret to 1.\n\nThe firstpart is format whole number bulls as text. The secondpart is format whole number cows as text. The result is empty text. Place firstpart into result. Place \"A\" into result. Place secondpart into result. Place \"B\" into result. Show result.\n","expected":"1A3B\n","step_budget":2000000},{"id":300,"slug":"longest-increasing-subsequence","title":"Longest Increasing Subsequence","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 10, 9, 2, 5, 3, 7, 101, and 18. Keep a shared dp as an empty list of whole numbers.\nFor every spot from 0 to 7.\nPlace 1 into dp.\n\nKeep a shared best of 0.\n\nTo extend from spot (a whole number) with before (a whole number). If before is at least spot, return. If item before of numbers is less than item spot of numbers and item before of dp plus 1 is more than best, set best to item before of dp plus 1. Extend from spot with before plus 1.\n\nFor every spot from 1 to 7.\nSet best to 1. Extend from spot with 0. Set item spot of dp to best.\n\nThe answer is 1.\nFor each value in dp.\nIf value is more than answer, set answer to value.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":301,"slug":"remove-invalid-parentheses","title":"Remove Invalid Parentheses","difficulty":"Hard","category":"String","code":"Keep a shared source as empty text. Keep a shared candidate as empty text. Keep a shared probe as empty text. Keep a shared answers as an empty list of text. Keep a shared balance of 0. Keep a shared good of 0. Keep a shared duplicate of 0. Keep a shared best of 0. Keep a shared bits of 0. Keep a shared need of 0. Place \"()())()\" into source. Set best to -1.\nTo build from mask (a whole number) with spot (a whole number). If spot is more than 6, return. The raised is shift 1 left by spot. The bit is bitwise and of mask and raised. If bit is more than 0, appendchar from spot. Build from mask with spot plus 1.\n\nTo appendchar from spot (a whole number). The piece is the slice of source from spot to spot plus 1. Place piece into candidate.\n\nTo check from spot (a whole number). If spot is more than the last position of candidate, return. The piece is the slice of candidate from spot to spot plus 1. If piece matches \"(\", add 1 to balance. If piece matches \")\", subtract 1 from balance. If balance is less than 0, set good to 0. Check from spot plus 1.\n\nTo count from mask (a whole number) with spot (a whole number). If spot is more than 6, return. The raised is shift 1 left by spot. The bit is bitwise and of mask and raised. If bit is more than 0, add 1 to bits. Count from mask with spot plus 1.\n\nTo look from spot (a whole number). If spot is more than the last position of answers, return. If item spot of answers matches probe, set duplicate to 1, return. Look from spot plus 1.\n\nFor every spot from 0 to 6.\nThe piece is the slice of source from spot to spot plus 1. If piece matches \"(\", add 1 to balance. If piece matches \")\", subtract 1 from balance. If balance is less than 0, set balance to 0, add 1 to need.\n\nIncrease need by balance. The keepcount is 7 minus need.\nFor every mask from 0 to 127.\nSet bits to 0. Count from mask with 0.\nIf bits is keepcount.\nSet candidate to empty text. Build from mask with 0. Set balance to 0. Set good to 1. Check from 0.\nIf good is 1 and balance is 0.\nThe length is the last position of candidate. If length is more than best, set best to length.\n\nFor every mask from 0 to 127.\nSet bits to 0. Count from mask with 0.\nIf bits is keepcount.\nSet candidate to empty text. Build from mask with 0. Set balance to 0. Set good to 1. Check from 0.\nIf good is 1 and balance is 0.\nThe length is the last position of candidate.\nIf length is best.\nSet duplicate to 0. Set probe to empty text. Place candidate into probe. Look from 0. If duplicate is 0, The copy is a copy of candidate, Place copy into answers.\n\nThe lastanswer is the last position of answers.\nFor every left from 0 to lastanswer.\nFor every right from left to lastanswer.\nIf item right of answers comes before item left of answers, swap item left of answers and item right of answers.\n\nFor each answer in answers, show answer.\n","expected":"(())()\n()()()\n","step_budget":5052513},{"id":306,"slug":"additive-number","title":"Additive Number","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Keep a shared parsed of 0. Keep a shared valid of 0. Place \"112358\" into source.\nTo parse from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The digit is the digit value of character spot of source. Set parsed to parsed times 10 plus digit. Parse from spot plus 1 with finish.\n\nTo follow from position (a whole number) with before (a whole number) and previous (a whole number). If position is more than the last position of source, set valid to 1, return. The sum is before plus previous. The piece is format whole number sum as text. The size is the last position of piece. The finish is position plus size. If finish is more than the last position of source, return. Set parsed to 0. Parse from position with finish. The nextvalue is parsed. If nextvalue is not sum, return. Follow from finish plus 1 with previous and nextvalue.\n\nFor every firstsize from 1 to 4.\nFor every secondsize from 1 to 4.\nIf firstsize plus secondsize is at most 5 and valid is 0.\nSet parsed to 0. Parse from 0 with firstsize minus 1. The firstnumber is parsed. The secondstart is firstsize. The secondend is firstsize plus secondsize minus 1. Set parsed to 0. Parse from secondstart with secondend. The secondnumber is parsed. Follow from secondend plus 1 with firstnumber and secondnumber.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":309,"slug":"best-time-to-buy-and-sell-stock-with-cooldown","title":"Best Time to Buy and Sell Stock with Cooldown","difficulty":"Medium","category":"Array","code":"The prices is a list of 1, 2, 3, 0, and 2. The last is the last position of prices. The holding is -1000000. The sold is 0. The resting is 0.\nFor every spot from 0 to last.\nThe price is item spot of prices. The oldholding is holding. The oldsold is sold. The oldresting is resting. The buying is oldresting minus price. If buying is more than oldholding, set holding to buying, otherwise set holding to oldholding. Set sold to oldholding plus price. If oldsold is more than oldresting, set resting to oldsold, otherwise set resting to oldresting.\n\nIf sold is more than resting, show sold, otherwise show resting.\n","expected":"3\n","step_budget":2000000},{"id":310,"slug":"minimum-height-trees","title":"Minimum Height Trees","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared matrix as empty list of whole numbers. Keep a shared deepest of 0.\nFor every spot from 0 to 15.\nPlace 0 into matrix.\n\nSet item 4 of matrix to 1. Set item 1 of matrix to 1. Set item 6 of matrix to 1. Set item 9 of matrix to 1. Set item 7 of matrix to 1. Set item 13 of matrix to 1. The heights is a list of 4 zeros.\nTo walk from node (a whole number) with parent (a whole number) and depth (a whole number). If depth is more than deepest, set deepest to depth.\nFor every other from 0 to 3.\nThe at is node times 4 plus other.\nIf item at of matrix is 1 and other is not parent.\nWalk from other with node and depth plus 1.\n\nFor every root from 0 to 3.\nSet deepest to 0. Walk from root with -1 and 0. Set item root of heights to deepest.\n\nThe best is item 0 of heights.\nFor every root from 1 to 3.\nIf item root of heights is less than best, set best to item root of heights.\n\nFor every root from 0 to 3.\nIf item root of heights is best, show root.\n","expected":"1\n","step_budget":2000000},{"id":312,"slug":"burst-balloons","title":"Burst Balloons","difficulty":"Hard","category":"Array","code":"Keep a shared values as an empty list of whole numbers. Keep a shared memo as an empty list of whole numbers. The numbers is a list of 3, 1, 5, and 8. Place 1 into values.\nFor every spot from 0 to 3.\nPlace item spot of numbers into values.\n\nPlace 1 into values.\nFor every spot from 0 to 35.\nPlace -1 into memo.\n\nTo burst from left (a whole number) with right (a whole number). The slot is left times 6 plus right. If item slot of memo is at least 0, return. If right minus left is less than 2, set item slot of memo to 0, return. Set item slot of memo to 0.\nFor every spot from left plus 1 to right minus 1.\nBurst from left with spot. Burst from spot with right. The first is item (left times 6 plus spot) of memo. The second is item (spot times 6 plus right) of memo. The gain is item left of values times item spot of values times item right of values. The candidate is gain plus first plus second. If candidate is more than item slot of memo, set item slot of memo to candidate.\n\nBurst from 0 with 5. Show item 5 of memo.\n","expected":"167\n","step_budget":2000000},{"id":313,"slug":"super-ugly-number","title":"Super Ugly Number","difficulty":"Medium","category":"Array","code":"Keep a shared nexts as an empty list of whole numbers. Keep a shared smallest of 0. The primes is a list of 2, 7, 13, and 19. The ugly is an empty list of whole numbers. Place 1 into ugly. The markers is a list of 4 zeros.\nFor every spot from 0 to 3.\nPlace item spot of primes into nexts.\n\nTo find from spot (a whole number) with limit (a whole number). If spot is more than limit, return. If item spot of nexts is less than smallest, set smallest to item spot of nexts. Find from spot plus 1 with limit.\n\nFor every count from 1 to 11.\nSet smallest to item 0 of nexts. Find from 1 with 3. Place smallest into ugly.\nFor every spot from 0 to 3.\nIf item spot of nexts is smallest.\nThe marker is item spot of markers. Set item spot of markers to marker plus 1. The product is item (marker plus 1) of ugly times item spot of primes. Set item spot of nexts to product.\n\nShow item 11 of ugly.\n","expected":"32\n","step_budget":2000000},{"id":315,"slug":"count-of-smaller-numbers-after-self","title":"Count of Smaller Numbers After Self","difficulty":"Hard","category":"Array","code":"Keep a shared numbers as an empty list of whole numbers. Keep a shared counts as an empty list of whole numbers. Place 5 into numbers. Place 2 into numbers. Place 6 into numbers. Place 1 into numbers.\nFor every spot from 0 to 3.\nPlace 0 into counts.\n\nTo scan from outer (a whole number) with inner (a whole number). If inner is more than 3, return. If item inner of numbers is less than item outer of numbers, set item outer of counts to item outer of counts plus 1. Scan from outer with inner plus 1.\n\nFor every outer from 0 to 3.\nScan from outer with outer plus 1.\n\nThe line is empty text.\nFor every spot from 0 to 3.\nIf spot is more than 0, Place \",\" into line. The piece is format whole number item spot of counts as text. Place piece into line.\n\nShow line.\n","expected":"2,1,1,0\n","step_budget":2000000},{"id":316,"slug":"remove-duplicate-letters","title":"Remove Duplicate Letters","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Keep a shared alphabet as empty text. Keep a shared symbol as empty text. Keep a shared picked as empty text. Keep a shared stack as empty text. Keep a shared lasts as empty list of whole numbers. Keep a shared used as empty list of whole numbers. Keep a shared position of 0. Keep a shared marks as an empty list of whole numbers. Place 0 into marks. Place \"bcabc\" into source. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet.\nFor every spot from 0 to 25.\nPlace 0 into lasts. Place 0 into used.\n\nTo locate from spot (a whole number). If spot is more than 25, return. The letter is the slice of alphabet from spot to spot plus 1. If letter matches symbol, set position to spot, return. Locate from spot plus 1.\n\nTo settle from spot (a whole number). If the length of stack is less than 1, Place picked into stack, set item (item 0 of marks) of used to 1, return. The topstart is the last position of stack. The topfinish is topstart plus 1. The top is the slice of stack from topstart to topfinish. Set symbol to empty text. Place top into symbol. Locate from 0. The topindex is position. The can is 0. If item topindex of lasts is more than spot, set can to 1. If symbol comes before picked, set can to 0. If can is 0, Place picked into stack, set item (item 0 of marks) of used to 1, return. Remove last character from stack. Set item topindex of used to 0. Settle from spot.\n\nFor every spot from 0 to 4.\nThe piece is the slice of source from spot to spot plus 1. Set symbol to empty text. Place piece into symbol. Locate from 0. Set item position of lasts to spot.\n\nFor every spot from 0 to 4.\nThe piece is the slice of source from spot to spot plus 1. Set symbol to empty text. Place piece into symbol. Locate from 0. Set item 0 of marks to position. Set picked to empty text. Place piece into picked. If item (item 0 of marks) of used is 0, settle from spot.\n\nShow stack.\n","expected":"abc\n","step_budget":2000000},{"id":318,"slug":"maximum-product-of-word-lengths","title":"Maximum Product of Word Lengths","difficulty":"Medium","category":"Array","code":"Keep a shared words as an empty list of text. Keep a shared masks as an empty list of whole numbers. Keep a shared sizes as an empty list of whole numbers. Keep a shared alphabet as empty text. Keep a shared symbol as empty text. Keep a shared position of 0. Place \"abcw\" into words. Place \"baz\" into words. Place \"foo\" into words. Place \"bar\" into words. Place \"xtfn\" into words. Place \"abcdef\" into words. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet.\nFor every spot from 0 to 5.\nPlace 0 into masks. Place 0 into sizes.\n\nTo locate from spot (a whole number). If spot is more than 25, return. The letter is the slice of alphabet from spot to spot plus 1. If letter matches symbol, set position to spot, return. Locate from spot plus 1.\n\nTo mark from index (a whole number) with spot (a whole number). If spot is at least item index of sizes, return. The word is item index of words. The piece is the slice of word from spot to spot plus 1. Set symbol to empty text. Place piece into symbol. Locate from 0. The raised is shift 1 left by position. The mixed is bitwise or of item index of masks and raised. Set item index of masks to mixed. Mark from index with spot plus 1.\n\nTo encode from index (a whole number). If index is more than 5, return. The word is item index of words. The size is the last position of word. Set item index of sizes to size plus 1. Mark from index with 0. Encode from index plus 1.\n\nEncode from 0. The best is 0.\nFor every left from 0 to 5.\nFor every right from left plus 1 to 5.\nThe common is bitwise and of item left of masks and item right of masks.\nIf common is 0.\nThe product is item left of sizes times item right of sizes. If product is more than best, set best to product.\n\nShow best.\n","expected":"16\n","step_budget":2387883},{"id":319,"slug":"bulb-switcher","title":"Bulb Switcher","difficulty":"Medium","category":"Math","code":"The number is 3. The root is 1.\nRepeat while root times root is at most number.\nAdd 1 to root.\n\nShow root minus 1.\n","expected":"1\n","step_budget":2000000},{"id":321,"slug":"create-maximum-number","title":"Create Maximum Number","difficulty":"Hard","category":"Array","code":"Keep a shared pool as an empty list of whole numbers. Keep a shared candidate as empty text. Keep a shared bestsub as empty text. Keep a shared lefttext as empty text. Keep a shared righttext as empty text. Keep a shared mixed as empty text. Keep a shared bestmixed as empty text. Keep a shared overall as empty text. Keep a shared picklo of 0. Keep a shared pickhi of 0. Keep a shared pickmask of 0. Keep a shared started of 0. Keep a shared improve of 0. Keep a shared bestmask of 0. Place 3 into pool. Place 4 into pool. Place 6 into pool. Place 5 into pool. Place 9 into pool. Place 1 into pool. Place 2 into pool. Place 5 into pool. Place 8 into pool. Place 3 into pool.\nTo attach from spot (a whole number). The digit is item spot of pool. The symbol is the character for digit. Place symbol into candidate.\n\nTo gather from spot (a whole number). If spot is more than pickhi, return. The offset is spot minus picklo. The raised is shift 1 left by offset. The bit is bitwise and of pickmask and raised. If bit is more than 0, attach from spot. Gather from spot plus 1.\n\nTo judge from spot (a whole number). If bestsub comes before candidate, set improve to 1.\n\nTo pick from lo (a whole number) with hi (a whole number) and target (a whole number). Set bestsub to empty text. Set picklo to lo. Set pickhi to hi. Set started to 0. If target is 0, return.\nFor every mask from 0 to 63.\nSet pickmask to mask. Set candidate to empty text. Gather from picklo. The lastp is the last position of candidate. The length is lastp plus 1.\nIf length is target.\nSet improve to 0. If started is 0, set improve to 1. If started is 1, judge from 0. If improve is 1, Set bestsub to empty text, Place candidate into bestsub, set started to 1.\n\nTo leftstep from i (a whole number) with j (a whole number). The piece is the slice of lefttext from i to i plus 1. Place piece into mixed. Blend from i plus 1 with j. Remove last character from mixed.\n\nTo rightstep from i (a whole number) with j (a whole number). The piece is the slice of righttext from j to j plus 1. Place piece into mixed. Blend from i with j plus 1. Remove last character from mixed.\n\nTo score from spot (a whole number). If started is 0, Set bestmixed to empty text, Place mixed into bestmixed, set started to 1, return. If bestmixed comes before mixed, Set bestmixed to empty text, Place mixed into bestmixed.\n\nTo judgeover from spot (a whole number). If overall comes before bestmixed, set improve to 1.\n\nTo blend from i (a whole number) with j (a whole number). The leftlast is the last position of lefttext. The rightlast is the last position of righttext. If i is more than leftlast and j is more than rightlast, score from 0, return. If i is at most leftlast, leftstep from i with j. If j is at most rightlast, rightstep from i with j.\n\nFor every firstcount from 0 to 4.\nThe secondcount is 5 minus firstcount.\nIf secondcount is at most 6.\nSet bestsub to empty text. Pick from 0 with 3 and firstcount. Set lefttext to empty text. Place bestsub into lefttext. Set bestsub to empty text. Pick from 4 with 9 and secondcount. Set righttext to empty text. Place bestsub into righttext. Set mixed to empty text. Set bestmixed to empty text. Set started to 0. Blend from 0 with 0. The oversize is the last position of overall. Set improve to 0. If oversize is -1, set improve to 1. If improve is 0, judgeover from 0. If improve is 1, Set overall to empty text, Place bestmixed into overall.\n\nThe line is empty text.\nFor every spot from 0 to 4.\nIf spot is more than 0, Place \",\" into line. The piece is the slice of overall from spot to spot plus 1. Place piece into line.\n\nShow line.\n","expected":"9,8,6,5,3\n","step_budget":18765280},{"id":322,"slug":"coin-change","title":"Coin Change","difficulty":"Medium","category":"Array","code":"Keep a shared coins holding 1, 2, and 5. Keep a shared dp as an empty list of whole numbers. The amount is 11.\nFor every spot from 0 to 11.\nPlace 12 into dp.\n\nSet item 0 of dp to 0.\nTo relax from value (a whole number) with spot (a whole number). If spot is more than 2, return. The coin is item spot of coins.\nIf coin is at most value.\nThe candidate is item (value minus coin) of dp plus 1. If candidate is less than item value of dp, set item value of dp to candidate. Relax from value with spot plus 1.\n\nFor every value from 1 to amount.\nRelax from value with 0.\n\nShow item amount of dp.\n","expected":"3\n","step_budget":2000000},{"id":324,"slug":"wiggle-sort-ii","title":"Wiggle Sort II","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 5, 1, 1, 6, and 4. Sort numbers. The size is 6. The half is 3. The result is a list of 6 zeros.\nFor every spot from 0 to 2.\nSet item (spot times 2) of result to item (half minus 1 minus spot) of numbers. Set item (spot times 2 plus 1) of result to item (size minus 1 minus spot) of numbers.\n\nThe line is empty text.\nFor every spot from 0 to 5.\nIf spot is more than 0, Place \",\" into line. The piece is format whole number item spot of result as text. Place piece into line.\n\nShow line.\n","expected":"1,6,1,5,1,4\n","step_budget":2000000},{"id":326,"slug":"power-of-three","title":"Power of Three","difficulty":"Easy","category":"Math","code":"The number is 27. The value is number.\nRepeat while value modulo 3 is 0.\nSet value to value divided by 3.\n\nIf value is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":327,"slug":"count-of-range-sum","title":"Count of Range Sum","difficulty":"Hard","category":"Array","code":"Keep a shared sums as an empty list of whole numbers. Keep a shared lower of 0. Keep a shared upper of 0. Keep a shared count of 0. The numbers is a list of -2, 5, and -1. Set lower to -2. Set upper to 2.\nFor every spot from 0 to 3.\nPlace 0 into sums.\n\nFor every spot from 1 to 3.\nSet item spot of sums to item (spot minus 1) of sums plus item (spot minus 1) of numbers.\n\nTo scan from right (a whole number) with left (a whole number). If left is at least right, return. The difference is item right of sums minus item left of sums. If difference is at least lower and difference is at most upper, add 1 to count. Scan from right with left plus 1.\n\nFor every right from 1 to 3.\nScan from right with 0.\n\nShow count.\n","expected":"3\n","step_budget":2000000},{"id":328,"slug":"odd-even-linked-list","title":"Odd Even Linked List","difficulty":"Medium","category":"Linked List","code":"The values is a list of 1, 2, 3, 4, and 5. The last is the last position of values. The odds is an empty list of whole numbers. The evens is an empty list of whole numbers.\nFor every spot from 0 to last.\nIf spot modulo 2 is 0, Place item spot of values into odds. If spot modulo 2 is 1, Place item spot of values into evens.\n\nFor each value in odds, show value. For each value in evens, show value.\n","expected":"1\n3\n5\n2\n4\n","step_budget":2000000},{"id":329,"slug":"longest-increasing-path-in-a-matrix","title":"Longest Increasing Path in a Matrix","difficulty":"Hard","category":"Array","code":"The cells is a list of 9, 9, 4, 6, 6, 8, 2, 1, and 1. The order is an empty list of whole numbers.\nFor every spot from 0 to 8.\nPlace spot into order.\n\nFor every left from 0 to 8.\nFor every right from left to 8.\nThe lcell is item left of order. The rcell is item right of order. If item rcell of cells is less than item lcell of cells, swap item left of order and item right of order.\n\nThe depth is a list of 1, 1, 1, 1, 1, 1, 1, 1, and 1.\nFor every rank from 0 to 8.\nThe spot is 8 minus rank. The cell is item spot of order. The row is cell divided by 3. The column is cell modulo 3. The here is item cell of cells. The best is 1. The up is 0. The down is 0. The west is 0. The east is 0. If row is more than 0, set up to item (cell minus 3) of depth. If row is less than 2, set down to item (cell plus 3) of depth. If column is more than 0, set west to item (cell minus 1) of depth. If column is less than 2, set east to item (cell plus 1) of depth. If row is more than 0 and item (cell minus 3) of cells is more than here and up plus 1 is more than best, set best to up plus 1. If row is less than 2 and item (cell plus 3) of cells is more than here and down plus 1 is more than best, set best to down plus 1. If column is more than 0 and item (cell minus 1) of cells is more than here and west plus 1 is more than best, set best to west plus 1. If column is less than 2 and item (cell plus 1) of cells is more than here and east plus 1 is more than best, set best to east plus 1. Set item cell of depth to best.\n\nThe answer is 0.\nFor every spot from 0 to 8.\nIf item spot of depth is more than answer, set answer to item spot of depth.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":330,"slug":"patching-array","title":"Patching Array","difficulty":"Hard","category":"Array","code":"The coins is a list of 1 and 3. The target is 6. The last is the last position of coins. The miss is 1. The spot is 0. The patches is 0.\nRepeat while miss is at most target.\nThe took is 0. If spot is at most last and item spot of coins is at most miss, set miss to miss plus item spot of coins, add 1 to spot, set took to 1. If took is 0, add 1 to patches, set miss to miss plus miss.\n\nShow patches.\n","expected":"1\n","step_budget":2000000},{"id":331,"slug":"verify-preorder-serialization-of-a-binary-tree","title":"Verify Preorder Serialization of a Binary Tree","difficulty":"Medium","category":"String","code":"The serial is \"9,3,4,#,#,1,#,#,2,#,6,#,#\". The tokens is split serial by \",\". The slots is 1. The valid is 1.\nFor each token in tokens.\nSubtract 1 from slots. If slots is less than 0, set valid to 0. If slots is less than 0, stop. If token does not match \"#\", add 2 to slots.\n\nIf valid is 1 and slots is 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":332,"slug":"reconstruct-itinerary","title":"Reconstruct Itinerary","difficulty":"Hard","category":"Array","code":"Keep a shared starts as an empty list of text. Keep a shared finishes as an empty list of text. Keep a shared used holding 0, 0, 0, and 0. Keep a shared route as an empty list of text. Keep a shared winner as an empty list of text. Keep a shared found of 0. Place \"MUC\" into starts. Place \"JFK\" into starts. Place \"SFO\" into starts. Place \"LHR\" into starts. Place \"LHR\" into finishes. Place \"MUC\" into finishes. Place \"SJC\" into finishes. Place \"SFO\" into finishes.\n\nTo save from spot (a whole number). If spot is more than the last position of route, return. Place item spot of route into winner. Save from spot plus 1.\n\nTo seek from depth (a whole number). If found is 1, return. If depth is 4, set found to 1. If depth is 4, save from 0. If depth is 4, return.\nFor every spot from 0 to 3.\nIf found is 1, stop. The origin is item spot of starts. The arrival is item spot of finishes. The same is 1. If origin comes before item depth of route, set same to 0. If item depth of route comes before origin, set same to 0. The hit is 0. If item spot of used is 0 and same is 1, set hit to 1. If hit is 1, set item spot of used to 1. If hit is 1, Place arrival into route. If hit is 1, seek from depth plus 1. If hit is 1, remove the last item from route. If hit is 1, set item spot of used to 0.\n\nPlace \"JFK\" into route. Seek from 0. The answers is join winner with \",\". The parts is split answers by \",\". For each part in parts, show part.\n","expected":"JFK\nMUC\nLHR\nSFO\nSJC\n","step_budget":2000000},{"id":334,"slug":"increasing-triplet-subsequence","title":"Increasing Triplet Subsequence","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 2, 3, 4, and 5. The first is 1000000000. The second is 1000000000. The found is 0.\nFor each value in numbers.\nIf found is 1, stop. If value is at most first, set first to value. If value is more than first and value is at most second, set second to value. If value is more than second, set found to 1.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":335,"slug":"self-crossing","title":"Self Crossing","difficulty":"Hard","category":"Array","code":"The distances is a list of 2, 1, 1, and 2. The xs is an empty list of whole numbers. The ys is an empty list of whole numbers. Place 0 into xs. Place 0 into ys. The horiz is 0. The vert is 0. The crossed is 0.\nFor every step from 0 to 3.\nThe direction is step modulo 4. The length is item step of distances. If direction is 0, set vert to vert plus length. If direction is 1, set horiz to horiz minus length. If direction is 2, set vert to vert minus length. If direction is 3, set horiz to horiz plus length. Place horiz into xs. Place vert into ys. The here is step plus 1. The alox is the smaller of item step of xs and item here of xs. The ahix is the larger of item step of xs and item here of xs. The aloy is the smaller of item step of ys and item here of ys. The ahiy is the larger of item step of ys and item here of ys.\nFor every other from 0 to step.\nIf other is less than step minus 1 and crossed is 0.\nThe blox is the smaller of item other of xs and item (other plus 1) of xs. The bhix is the larger of item other of xs and item (other plus 1) of xs. The bloy is the smaller of item other of ys and item (other plus 1) of ys. The bhiy is the larger of item other of ys and item (other plus 1) of ys. If ahix is at least blox and bhix is at least alox and ahiy is at least bloy and bhiy is at least aloy, set crossed to 1.\n\nIf crossed is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":336,"slug":"palindrome-pairs","title":"Palindrome Pairs","difficulty":"Hard","category":"Array","code":"Keep a shared words holding \"abcd\", \"dcba\", \"lls\", \"s\", and \"sssll\". Keep a shared combined as empty text. Keep a shared okay of 0.\n\nTo check from left (a whole number) with right (a whole number). If left is at least right, set okay to 1, return. If character left of combined is not character right of combined, set okay to 0, return. Check from left plus 1 with right minus 1.\n\nFor every first from 0 to 4.\nFor every second from 0 to 4.\nIf first is not second.\nSet combined to empty text. The one is item first of words. Place one into combined. The two is item second of words. Place two into combined. Set okay to 0. The last is the last position of combined. Check from 0 with last.\nIf okay is 1.\nThe lefttext is format whole number first as text. The righttext is format whole number second as text. The line is empty text. Place \"[\" into line. Place lefttext into line. Place \", \" into line. Place righttext into line. Place \"]\" into line. Display line.\n","expected":"[0, 1]\n[1, 0]\n[2, 4]\n[3, 2]\n","step_budget":2000000},{"id":337,"slug":"house-robber-iii","title":"House Robber III","difficulty":"Medium","category":"Dynamic Programming","code":"Keep a shared values holding 3, 2, 3, -1, 3, -1, and 1. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1. Keep a shared robbed as an empty list of whole numbers.\nFor every spot from 0 to 6.\nPlace 0 into robbed.\n\nKeep a shared aside as an empty list of whole numbers.\nFor every spot from 0 to 6.\nPlace 0 into aside.\n\nTo score 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, score from left. If right is at least 0, score from right. The here is item node of values. The leftaside is 0. The lefttake is 0. The rightaside is 0. The righttake is 0. If left is at least 0, set leftaside to item left of aside. If left is at least 0, set lefttake to item left of robbed. If right is at least 0, set rightaside to item right of aside. If right is at least 0, set righttake to item right of robbed. The bestleft is the larger of leftaside and lefttake. The bestright is the larger of rightaside and righttake. Set item node of robbed to here plus leftaside plus rightaside. Set item node of aside to bestleft plus bestright.\n\nScore from 0. The answer is the larger of item 0 of robbed and item 0 of aside. Show answer.\n","expected":"7\n","step_budget":2000000},{"id":338,"slug":"counting-bits","title":"Counting Bits","difficulty":"Easy","category":"Dynamic Programming","code":"The limit is 5. The bits is a list of 6 zeros. Set item 0 of bits to 0.\nFor every value from 1 to limit.\nThe half is value divided by 2. The rest is value modulo 2. Set item value of bits to item half of bits plus rest.\n\nFor every value from 0 to limit.\nShow item value of bits.\n","expected":"0\n1\n1\n2\n1\n2\n","step_budget":2000000},{"id":342,"slug":"power-of-four","title":"Power of Four","difficulty":"Easy","category":"Math","code":"The number is 16. The value is number. The failed is 0.\nRepeat while value is more than 1 and failed is 0.\nIf value modulo 4 is not 0, set failed to 1. If value modulo 4 is 0, set value to value divided by 4.\n\nIf failed is 0 and value is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":343,"slug":"integer-break","title":"Integer Break","difficulty":"Medium","category":"Math","code":"Keep a shared depth as an empty list of whole numbers.\nFor every spot from 0 to 10.\nPlace 0 into depth.\n\nKeep a shared best of 0.\n\nTo search from value (a whole number) with cut (a whole number). If cut is more than value minus 1, return. The other is value minus cut. The left is the larger of cut and item cut of depth. The right is the larger of other and item other of depth. The product is left times right. If product is more than best, set best to product. Search from value with cut plus 1.\n\nSet item 1 of depth to 1.\nFor every value from 2 to 10.\nSet best to 1. Search from value with 1. Set item value of depth to best.\n\nShow item 10 of depth.\n","expected":"36\n","step_budget":2000000},{"id":344,"slug":"reverse-string","title":"Reverse String","difficulty":"Easy","category":"String","code":"The letters is a list of \"h\", \"e\", \"l\", \"l\", and \"o\". The left is 0. The right is 4.\nRepeat while left is less than right.\nThe saved is empty text. Set saved to item left of letters. Set item left of letters to item right of letters. Set item right of letters to saved. Add 1 to left. Subtract 1 from right.\n\nFor each letter in letters, show letter.\n","expected":"o\nl\nl\ne\nh\n","step_budget":2000000},{"id":345,"slug":"reverse-vowels-of-a-string","title":"Reverse Vowels of a String","difficulty":"Easy","category":"String","code":"Keep a shared source as empty text. Place \"hello\" into source. Keep a shared vowel of 0. Keep a shared vowels as empty text.\n\nTo classify from spot (a whole number). Set vowel to 0. The symbol is character spot of source. If symbol is character 0 of \"aeiou\" or symbol is character 1 of \"aeiou\" or symbol is character 2 of \"aeiou\" or symbol is character 3 of \"aeiou\" or symbol is character 4 of \"aeiou\" or symbol is character 0 of \"AEIOU\" or symbol is character 1 of \"AEIOU\" or symbol is character 2 of \"AEIOU\" or symbol is character 3 of \"AEIOU\" or symbol is character 4 of \"AEIOU\", set vowel to 1.\n\nTo gather from spot (a whole number). If spot is more than 4, return. Classify from spot. If vowel is 1, The symbol is character spot of source, Place symbol into vowels. Gather from spot plus 1.\n\nGather from 0. The backwards is empty text. The last is the last position of vowels.\nFor every rank from 0 to last.\nThe spot is last minus rank. The symbol is character spot of vowels. Place symbol into backwards.\n\nThe result is empty text. The used is 0.\nFor every spot from 0 to 4.\nClassify from spot. If vowel is 1, The symbol is character used of backwards, Place symbol into result, add 1 to used. If vowel is 0, The symbol is character spot of source, Place symbol into result.\n\nShow result.\n","expected":"holle\n","step_budget":2000000},{"id":347,"slug":"top-k-frequent-elements","title":"Top K Frequent Elements","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 1, 1, 2, 2, and 3. The wanted is 2. The counts is an empty map.\nFor each value in numbers.\nAdd 1 to entry value of counts.\n\nThe distinct is an empty list of whole numbers.\nFor each value in numbers.\nIf distinct contains value, skip to the next one. Place value into distinct.\n\nThe last is the last position of distinct.\nFor every left from 0 to last.\nFor every right from left to last.\nThe leftvalue is item left of distinct. The rightvalue is item right of distinct. The leftcount is entry leftvalue of counts. The rightcount is entry rightvalue of counts. If rightcount is more than leftcount, swap item left of distinct and item right of distinct.\n\nFor every spot from 0 to wanted minus 1.\nShow item spot of distinct.\n","expected":"1\n2\n","step_budget":2000000},{"id":349,"slug":"intersection-of-two-arrays","title":"Intersection of Two Arrays","difficulty":"Easy","category":"Array","code":"The first is a list of 1, 2, 2, and 1. The second is a list of 2 and 2. The answers is an empty list of whole numbers.\nFor each value in first.\nIf answers contains value, skip to the next one. If second contains value, Place value into answers.\n\nSort answers. For each value in answers, show value.\n","expected":"2\n","step_budget":2000000},{"id":350,"slug":"intersection-of-two-arrays-ii","title":"Intersection of Two Arrays II","difficulty":"Easy","category":"Array","code":"The first is a list of 1, 2, 2, and 1. The second is a list of 2 and 2. The used is a list of 0 and 0. The answers is an empty list of whole numbers.\nFor each value in first.\nThe found is 0.\nFor every spot from 0 to 1.\nIf found is 0 and item spot of used is 0 and item spot of second is value, set item spot of used to 1, set found to 1, Place value into answers.\n\nFor each value in answers, show value.\n","expected":"2\n2\n","step_budget":2000000},{"id":354,"slug":"russian-doll-envelopes","title":"Russian Doll Envelopes","difficulty":"Hard","category":"Array","code":"Keep a shared widths holding 5, 6, 6, and 7. Keep a shared heights holding 4, 4, 7, and 8. Keep a shared memo as an empty list of whole numbers.\nFor every spot from 0 to 3.\nPlace 0 into memo.\n\nTo chain from index (a whole number). If index is 0, set item 0 of memo to 1, return. If item index of memo is more than 0, return. The best is 1.\nFor every prior from 0 to index minus 1.\nThe narrow is item prior of widths. The short is item prior of heights.\nIf narrow is less than item index of widths and short is less than item index of heights.\nChain from prior. The candidate is item prior of memo plus 1. If candidate is more than best, set best to candidate. Set item index of memo to best.\n\nThe answer is 1.\nFor every spot from 0 to 3.\nChain from spot. If item spot of memo is more than answer, set answer to item spot of memo.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":357,"slug":"count-numbers-with-unique-digits","title":"Count Numbers with Unique Digits","difficulty":"Medium","category":"Math","code":"The digits is 2. The total is 1. The product is 9.\nFor every length from 1 to digits.\nIf length is 1, add 9 to total. If length is more than 1, set product to product times (11 minus length), Add product to total.\n\nShow total.\n","expected":"91\n","step_budget":2000000},{"id":363,"slug":"max-sum-of-rectangle-no-larger-than-k","title":"Max Sum of Rectangle No Larger Than K","difficulty":"Hard","category":"Array","code":"Keep a shared prefix as an empty list of whole numbers.\nFor every spot from 0 to 15.\nPlace 0 into prefix.\n\nKeep a shared best of -1000000. The chart is a list of 1, 0, 1, 0, -1, 0, 1, 0, and 1.\nFor every spot from 0 to 8.\nThe row is spot divided by 3. The column is spot modulo 3. The target is (row plus 1) times 4 plus column plus 1. The above is target minus 4. The aside is target minus 1. The corner is target minus 5. Set item target of prefix to item spot of chart plus item above of prefix plus item aside of prefix minus item corner of prefix.\n\nTo sweep from left (a whole number) at top (a whole number) with bottom (a whole number). If left is at least 3, return. Sweep from left plus 1 at top with bottom.\nFor every right from left to 2.\nThe zone is (bottom plus 1) times 4 plus right plus 1. The upper is top times 4 plus right plus 1. The leftwan is top times 4 plus left. The leftsouth is (bottom plus 1) times 4 plus left. The total is item zone of prefix minus item upper of prefix minus item leftsouth of prefix plus item leftwan of prefix. If total is at most 2 and total is more than best, set best to total.\n\nTo bands from top (a whole number) with bottom (a whole number). If top is at least 3, return. If bottom is at least 3, Bands from top plus 1 with top plus 1, return. Sweep from 0 at top with bottom. Bands from top with bottom plus 1.\n\nBands from 0 with 0. Show best.\n","expected":"2\n","step_budget":2000000},{"id":365,"slug":"water-and-jug-problem","title":"Water and Jug Problem","difficulty":"Medium","category":"Math","code":"The first is 3. The second is 5. The target is 4. Keep a shared common of 0.\nTo reduce from left (a whole number) with right (a whole number). If right is 0, set common to left, return. The rest is left modulo right. Reduce from right with rest.\n\nReduce from first with second. If target is at most first plus second and target modulo common is 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":367,"slug":"valid-perfect-square","title":"Valid Perfect Square","difficulty":"Easy","category":"Math","code":"The number is 16. The root is 0. The spot is 1.\nRepeat while spot times spot is at most number.\nIf spot times spot is number, set root to spot. Add 1 to spot.\n\nIf root is 0, show false, otherwise show true.\n","expected":"true\n","step_budget":2000000},{"id":368,"slug":"largest-divisible-subset","title":"Largest Divisible Subset","difficulty":"Medium","category":"Array","code":"Keep a shared nums holding 1, 2, 4, and 8. Sort nums. Keep a shared memo as an empty list of whole numbers.\nFor every spot from 0 to 3.\nPlace 0 into memo.\n\nTo chain from index (a whole number). If index is 0, set item 0 of memo to 1, return. If item index of memo is more than 0, return. The best is 1.\nFor every prior from 0 to index minus 1.\nThe rest is item index of nums modulo item prior of nums.\nIf rest is 0.\nChain from prior. The candidate is item prior of memo plus 1. If candidate is more than best, set best to candidate. Set item index of memo to best.\n\nThe bestend is 0. The bestlen is 0.\nFor every spot from 0 to 3.\nChain from spot. If item spot of memo is more than bestlen, set bestlen to item spot of memo, set bestend to spot.\n\nKeep a shared prior of 0.\nTo seek from spot (a whole number) with target (a whole number). If spot is less than 0, set prior to -1, return. The rest is item target of nums modulo item spot of nums. If rest is 0 and item spot of memo plus 1 is item target of memo, set prior to spot, return. Seek from spot minus 1 with target.\n\nThe current is bestend. The reversed is an empty list of whole numbers.\nRepeat while current is at least 0.\nPlace item current of nums into reversed. Seek from current minus 1 with current. Set current to prior.\n\nThe parts is an empty list of text. The lastrev is the last position of reversed.\nFor every spot from 0 to lastrev.\nThe source is lastrev minus spot. The piece is format whole number item source of reversed as text. Place piece into parts.\n\nThe line is join parts with \",\". Show line.\n","expected":"1,2,4,8\n","step_budget":2000000},{"id":371,"slug":"sum-of-two-integers","title":"Sum of Two Integers","difficulty":"Medium","category":"Math","code":"The first is 1. The second is 2. The left is first. The right is second.\nRepeat while right is not 0.\nThe carry is bitwise and of left and right. Set left to exclusive or of left and right. Set right to shift carry left by 1.\n\nShow left.\n","expected":"3\n","step_budget":2000000},{"id":372,"slug":"super-pow","title":"Super Pow","difficulty":"Medium","category":"Math","code":"The base is 2. The digits is a list of 1 and 0. The exponent is 0.\nFor each digit in digits.\nSet exponent to exponent times 10 plus digit.\n\nThe result is 1. The reduced is base modulo 1337.\nRepeat while exponent is more than 0.\nSet result to result times reduced modulo 1337. Subtract 1 from exponent.\n\nShow result.\n","expected":"1024\n","step_budget":2000000},{"id":373,"slug":"find-k-pairs-with-smallest-sums","title":"Find K Pairs with Smallest Sums","difficulty":"Medium","category":"Array","code":"Keep a shared firsts holding 1, 7, and 11. Keep a shared seconds holding 2, 4, and 6. Keep a shared used as an empty list of whole numbers.\nFor every spot from 0 to 8.\nPlace 0 into used.\n\nKeep a shared pickrow of 0. Keep a shared pickcolumn of 0. Keep a shared smallest of 0.\n\nTo scan from spot (a whole number). If spot is at least 9, return. The row is spot divided by 3. The column is spot modulo 3. The total is item row of firsts plus item column of seconds. If item spot of used is 0 and total is less than smallest, set smallest to total, set pickrow to row, set pickcolumn to column. Scan from spot plus 1.\n\nThe answers is an empty list of text. The round is 0.\nRepeat while round is less than 3.\nSet smallest to 1000000. Scan from 0. The slot is pickrow times 3 plus pickcolumn. Set item slot of used to 1. The chosenrow is pickrow. The chosencolumn is pickcolumn. The left is format whole number item chosenrow of firsts as text. The right is format whole number item chosencolumn of seconds as text. The line is empty text. Place left into line. Place \",\" into line. Place right into line. Place line into answers. Add 1 to round.\n\nFor each answer in answers, show answer.\n","expected":"1,2\n1,4\n1,6\n","step_budget":2000000},{"id":375,"slug":"guess-number-higher-or-lower-ii","title":"Guess Number Higher or Lower II","difficulty":"Medium","category":"Math","code":"Keep a shared memo as an empty list of whole numbers.\nFor every spot from 0 to 120.\nPlace 0 into memo.\n\nTo score from low (a whole number) with high (a whole number). If low is at least high, return. The slot is low times 11 plus high. If item slot of memo is more than 0, return. The best is 1000000.\nFor every pick from low to high.\nThe left is 0. The right is 0. If pick is more than low, score from low with pick minus 1, set left to item (low times 11 plus pick minus 1) of memo. If pick is less than high, score from pick plus 1 with high, set right to item ((pick plus 1) times 11 plus high) of memo. The worst is left. If right is more than worst, set worst to right. The cost is pick plus worst. If cost is less than best, set best to cost. Set item slot of memo to best.\n\nScore from 1 with 10. Show item 21 of memo.\n","expected":"16\n","step_budget":2000000},{"id":376,"slug":"wiggle-subsequence","title":"Wiggle Subsequence","difficulty":"Medium","category":"Array","code":"The nums is a list of 1, 7, 4, 9, 2, and 5. The last is 5. The count is 1. The direction is 0.\nFor every spot from 1 to last.\nThe change is item spot of nums minus item (spot minus 1) of nums. If change is more than 0 and direction is at most 0, add 1 to count. If change is less than 0 and direction is at least 0, add 1 to count. If change is not 0, set direction to change.\n\nShow count.\n","expected":"6\n","step_budget":2000000},{"id":377,"slug":"combination-sum-iv","title":"Combination Sum IV","difficulty":"Medium","category":"Array","code":"The nums is a list of 1, 2, and 3. The target is 4. The ways is a list of 5 zeros. Set item 0 of ways to 1.\nFor every total from 1 to 4.\nFor each value in nums.\nIf total is at least value.\nThe prior is total minus value. The add is item prior of ways. Increase item total of ways by add.\n\nShow item 4 of ways.\n","expected":"7\n","step_budget":2000000},{"id":378,"slug":"kth-smallest-element-in-a-sorted-matrix","title":"Kth Smallest Element in a Sorted Matrix","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 5, 9, 10, 11, 13, 12, 13, and 15. Keep a shared chosen of 0.\nTo seek from spot (a whole number) with best (a whole number). If spot is more than 8, set chosen to best, return. If item spot of numbers is less than item best of numbers, set best to spot. Seek from spot plus 1 with best.\n\nFor every position from 0 to 8.\nSeek from position with position. swap item position of numbers and item chosen of numbers.\n\nShow item 7 of numbers.\n","expected":"13\n","step_budget":2000000},{"id":382,"slug":"linked-list-random-node","title":"Linked List Random Node","difficulty":"Medium","category":"Math","code":"The values is a list of 1, 2, and 3. The nexts is a list of 1, 2, and -1. The node is 0. The rank is 0. The chosen is 0. The state is 12345.\nRepeat while node is at least 0.\nAdd 1 to rank. Set state to state times 1103515245 plus 12345. Set state to state modulo 2147483648. The draw is state modulo rank. If draw is 0, set chosen to node. Set node to item node of nexts.\n\nShow item chosen of values.\n","expected":"1\n","step_budget":2000000},{"id":383,"slug":"ransom-note","title":"Ransom Note","difficulty":"Easy","category":"String","code":"Keep a shared magazine as empty text. Keep a shared note as empty text. Keep a shared seeds as an empty list of text. Keep a shared taken as an empty list of whole numbers. Keep a shared limit of 0. Keep a shared found of 0. Place \"b\" into seeds. Place \"a\" into seeds. Set magazine to item 0 of seeds. Set note to item 1 of seeds. The lastmag is the last position of magazine. Set limit to lastmag.\nFor every spot from 0 to lastmag.\nPlace 0 into taken.\n\nTo find from spot (a whole number) with target (a whole number). If spot is more than limit, set found to -1, return. If item spot of taken is 0 and character spot of magazine is character target of note, set found to spot, return. Find from spot plus 1 with target.\n\nThe valid is 1. The last is the last position of note.\nFor every spot from 0 to last.\nFind from 0 with spot. If found is less than 0, set valid to 0. If found is at least 0, The slot is found, Set item slot of taken to 1.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":385,"slug":"mini-parser","title":"Mini Parser","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Place \"[123,[456,[789]]]\" into source. Keep a shared cursor of 0. Keep a shared rendered as empty text. Keep a shared value of 0.\n\nTo done. The piece is format whole number value as text. Place piece into rendered.\n\nTo read. The here is cursor. If here is more than the last position of source, done, return. The symbol is character here of source. If symbol is not between \"0\" and \"9\", done, return. The digit is the digit value of symbol. Set value to value times 10 plus digit. Add 1 to cursor. Read.\n\nTo parse group. Place \"[\" into rendered. Add 1 to cursor.\nRepeat while cursor is at most the last position of source.\nThe here is cursor. The symbol is character here of source. If symbol is \"]\", Place \"]\" into rendered, add 1 to cursor, return. If symbol is \",\", Place \",\" into rendered, add 1 to cursor. If symbol is \"[\", parse group. If symbol is \"-\", Place \"-\" into rendered, add 1 to cursor, set value to 0, read. If symbol is between \"0\" and \"9\", set value to 0, read.\n\nParse group. Show rendered.\n","expected":"[123,[456,[789]]]\n","step_budget":2000000},{"id":386,"slug":"lexicographical-numbers","title":"Lexicographical Numbers","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared ceiling of 13.\nTo walk from value (a whole number). If value is more than ceiling, return. Show value.\nFor every digit from 0 to 9.\nThe next is value times 10 plus digit. If next is at most ceiling, walk from next.\n\nFor every start from 1 to 9.\nWalk from start.\n","expected":"1\n10\n11\n12\n13\n2\n3\n4\n5\n6\n7\n8\n9\n","step_budget":2000000},{"id":387,"slug":"first-unique-character-in-a-string","title":"First Unique Character in a String","difficulty":"Easy","category":"String","code":"Keep a shared source as empty text. Place \"leetcode\" into source. Keep a shared wanted as empty text. Keep a shared count of 0. Keep a shared answer of -1.\n\nTo tally from other (a whole number) with finish (a whole number). If other is more than finish, return. The piece is the slice of source from other to other plus 1. If piece is wanted, add 1 to count. Tally from other plus 1 with finish.\n\nTo check from spot (a whole number). Set wanted to the slice of source from spot to spot plus 1. Set count to 0. Tally from 0 with the last position of source. If count is 1 and answer is -1, set answer to spot.\n\nFor every spot from 0 to the last position of source.\nCheck from spot.\n\nShow answer.\n","expected":"0\n","step_budget":2000000},{"id":388,"slug":"longest-absolute-file-path","title":"Longest Absolute File Path","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Place \"dir\\n\\tsubdir1\\n\\tsubdir2\\n\\t\\tfile.ext\" into source. Keep a shared current as empty text. Keep a shared depth of 0. Keep a shared isfile of 0.\n\nTo measure.\nFor every spot from 0 to the last position of current.\nIf character spot of current is not \"\\t\", break. Add 1 to depth.\n\nTo mark.\nFor every spot from 0 to the last position of current.\nIf character spot of current is \".\", set isfile to 1, break.\n\nThe parts is split source by \"\\n\". The lastpart is the last position of parts. The prefix is a list of 20 zeros. The best is 0.\nFor every index from 0 to lastpart.\nSet current to item index of parts. Set depth to 0. Measure. The deep is depth. The last is the last position of current. The size is last plus 1. The name is the slice of current from deep to size. The final is the last position of name. The namelen is final plus 1. Set current to name. Set isfile to 0. Mark. The candidate is 0. The total is 0. If isfile is 1, set candidate to namelen. If isfile is 1 and deep is more than 0, set candidate to candidate plus item (deep minus 1) of prefix. If isfile is 1 and deep is more than 0, set candidate to candidate plus 1. If isfile is 1 and candidate is more than best, set best to candidate. If isfile is 0, set total to namelen. If isfile is 0 and deep is more than 0, set total to total plus item (deep minus 1) of prefix. If isfile is 0 and deep is more than 0, set total to total plus 1. If isfile is 0, set item deep of prefix to total.\n\nShow best.\n","expected":"20\n","step_budget":2000000},{"id":389,"slug":"find-the-difference","title":"Find the Difference","difficulty":"Easy","category":"String","code":"Keep a shared first as empty text. Place \"abcd\" into first. Keep a shared second as empty text. Place \"abcde\" into second. Keep a shared leftcount of 0. Keep a shared rightcount of 0.\n\nTo countleft from spot (a whole number). Set leftcount to 0.\nFor every mark from 0 to the last position of first.\nIf character mark of first is character spot of second, add 1 to leftcount.\n\nTo countright from spot (a whole number). Set rightcount to 0.\nFor every mark from 0 to the last position of second.\nIf character mark of second is character spot of second, add 1 to rightcount.\n\nThe answer is empty text.\nFor every spot from 0 to the last position of second.\nCountleft from spot. Countright from spot. If leftcount is less than rightcount, set answer to the slice of second from spot to one more than spot, break.\n\nShow answer.\n","expected":"e\n","step_budget":2000000},{"id":390,"slug":"elimination-game","title":"Elimination Game","difficulty":"Medium","category":"Math","code":"The numbers is a list of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The alive is a list of 9 zeros.\nFor every mark from 0 to 8.\nSet item mark of alive to 1.\n\nThe last is 8. The remaining is 9. The forward is 1.\nRepeat while remaining is more than 1.\nThe rank is 0. If forward is 1, for every spot from 0 to last, if item spot of alive is 1, add 1 to rank, if item spot of alive is 1, if rank modulo 2 is 1, set item spot of alive to 0, subtract 1 from remaining. If forward is 0, for every offset from 0 to last, the spot is last minus offset, if item spot of alive is 1, add 1 to rank, if item spot of alive is 1, if rank modulo 2 is 1, set item spot of alive to 0, subtract 1 from remaining. Set forward to 1 minus forward.\n\nFor every spot from 0 to last.\nIf item spot of alive is 1, show item spot of numbers.\n","expected":"6\n","step_budget":2000000},{"id":391,"slug":"perfect-rectangle","title":"Perfect Rectangle","difficulty":"Hard","category":"Array","code":"The lefts is a list of 1, 3, 3, 1, and 2. The bottoms is a list of 1, 1, 2, 3, and 3. The rights is a list of 3, 4, 4, 2, and 3. The tops is a list of 3, 2, 4, 4, and 4. The last is 4. The minleft is item 0 of lefts. The maxright is item 0 of rights. The minbottom is item 0 of bottoms. The maxtop is item 0 of tops. The area is 0.\nFor every spot from 0 to last.\nThe left is item spot of lefts. The right is item spot of rights. The bottom is item spot of bottoms. The top is item spot of tops. The width is right minus left. The height is top minus bottom. Add (width times height) to area. If left is less than minleft, set minleft to left. If right is more than maxright, set maxright to right. If bottom is less than minbottom, set minbottom to bottom. If top is more than maxtop, set maxtop to top.\n\nThe boxwidth is maxright minus minleft. The boxheight is maxtop minus minbottom. The boxarea is boxwidth times boxheight. The good is 1. If area is not boxarea, set good to 0. The leftmax is 0. The rightmin is 0. The bottommax is 0. The topmin is 0.\nFor every first from 0 to last.\nFor every second from 0 to last.\nIf second is at most first, skip to the next one. Set leftmax to item first of lefts. If item second of lefts is more than leftmax, set leftmax to item second of lefts. Set rightmin to item first of rights. If item second of rights is less than rightmin, set rightmin to item second of rights. Set bottommax to item first of bottoms. If item second of bottoms is more than bottommax, set bottommax to item second of bottoms. Set topmin to item first of tops. If item second of tops is less than topmin, set topmin to item second of tops. The width is rightmin minus leftmax. The height is topmin minus bottommax. If width is more than 0 and height is more than 0, set good to 0.\n\nIf good is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":392,"slug":"is-subsequence","title":"Is Subsequence","difficulty":"Easy","category":"String","code":"The source is \"abc\". The target is \"ahbgdc\". The sourcelast is the last position of source. The targetlast is the last position of target. The spot is 0. The mark is 0.\nRepeat while spot is at most sourcelast and mark is at most targetlast.\nThe symbol is character spot of source. The other is character mark of target. If symbol is other, add 1 to spot. Add 1 to mark.\n\nIf spot is more than sourcelast, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":393,"slug":"utf-8-validation","title":"UTF-8 Validation","difficulty":"Medium","category":"Array","code":"The items is a list of 197, 130, and 1. The size is 3. The spot is 0. The valid is 1.\nRepeat while spot is less than size and valid is 1.\nThe lead is item spot of items. The need is 0. The startpos is spot. If lead is less than 128, add 1 to spot. If lead is at least 192 and lead is less than 224, set need to 1, add 2 to spot. If lead is at least 224 and lead is less than 240, set need to 2, add 3 to spot. If lead is at least 240 and lead is less than 248, set need to 3, add 4 to spot. If lead is at least 128 and lead is less than 192, set valid to 0, add 1 to spot. If lead is at least 248, set valid to 0, add 1 to spot.\nFor every step from 1 to need.\nThe index is startpos plus step. If index is at least size, set valid to 0. If index is less than size and item index of items is less than 128, set valid to 0. If index is less than size and item index of items is more than 191, set valid to 0.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":394,"slug":"decode-string","title":"Decode String","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Place \"3[a]2[bc]\" into source. Keep a shared cursor of 0. Keep a shared frames as an empty list of text. Keep a shared counts as an empty list of whole numbers. Keep a shared multiplier of 0. The base is empty text. Place base into frames.\n\nTo gather. Set multiplier to 0.\nFor every step from 0 to the last position of source.\nThe here is cursor. If here is more than the last position of source, break. If character here of source is not between \"0\" and \"9\", break. The digit is the digit value of character here of source. Set multiplier to multiplier times 10 plus digit. Add 1 to cursor.\n\nTo enter. The fresh is empty text. Place fresh into frames. Place multiplier into counts. Set multiplier to 0. Add 1 to cursor.\n\nTo unwind. The depth is the number of items in frames. The part is item (depth minus 1) of frames. The times is item (depth minus 2) of counts. Remove the last item from frames. Remove the last item from counts. The duplicate is a copy of part. The parent is item (depth minus 2) of frames. Add 1 to cursor.\nFor every step from 1 to times.\nPlace duplicate into parent. Set item (depth minus 2) of frames to parent.\n\nTo emit. The depth is the number of items in frames. The here is cursor. The piece is the slice of source from here to here plus 1. The current is item (depth minus 1) of frames. Place piece into current. Set item (depth minus 1) of frames to current. Add 1 to cursor.\n\nRepeat while cursor is at most the last position of source.\nThe here is cursor. The symbol is character here of source. If symbol is between \"0\" and \"9\", gather. If symbol is \"[\", enter. If symbol is \"]\", unwind. If symbol is not between \"0\" and \"9\" and symbol is not \"[\" and symbol is not \"]\", emit.\n\nShow item 0 of frames.\n","expected":"aaabcbc\n","step_budget":2000000},{"id":395,"slug":"longest-substring-with-at-least-k-repeating-characters","title":"Longest Substring with At Least K Repeating Characters","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Place \"aaabb\" into source. Keep a shared needed of 3. Keep a shared wanted as empty text. Keep a shared count of 0. Keep a shared okay of 0.\n\nTo tally from other (a whole number) with finish (a whole number). If other is more than finish, return. The piece is the slice of source from other to other plus 1. If piece is wanted, add 1 to count. Tally from other plus 1 with finish.\n\nTo check from start (a whole number) with finish (a whole number). Set okay to 1.\nFor every spot from start to finish.\nSet wanted to the slice of source from spot to spot plus 1. Set count to 0. Tally from start with finish. If count is less than needed, set okay to 0.\n\nThe last is 4. The best is 0.\nFor every start from 0 to last.\nFor every finish from start to last.\nCheck from start with finish. The width is finish minus start plus 1. If okay is 1 and width is more than best, set best to width.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":396,"slug":"rotate-function","title":"Rotate Function","difficulty":"Medium","category":"Array","code":"The numbers is a list of 4, 3, 2, and 6. The size is 4. The last is 3. The best is -1000000.\nFor every turn from 0 to last.\nThe total is 0.\nFor every spot from 0 to last.\nThe source is spot plus turn. The source is source modulo size. The value is item source of numbers. Increase total by (spot times value). If total is more than best, set best to total.\n\nShow best.\n","expected":"26\n","step_budget":2000000},{"id":397,"slug":"integer-replacement","title":"Integer Replacement","difficulty":"Medium","category":"Dynamic Programming","code":"The start is 8. The queue is an empty list of whole numbers. The distances is an empty list of whole numbers. The seen is an empty list of whole numbers. Place start into queue. Place 0 into distances. Place start into seen. The head is 0. The depth is 1. The answer is 0. The found is 0.\nRepeat while head is less than depth and found is 0.\nThe current is item head of queue. The steps is item head of distances. Add 1 to head. The parity is current modulo 2. The chosen is current minus 1. The upper is current plus 1. If parity is 0, set chosen to current divided by 2. If chosen is 1, set answer to steps plus 1, set found to 1. If chosen is more than 1, if seen does not contain chosen, Place chosen into queue, Place (steps plus 1) into distances, Place chosen into seen, add 1 to depth. If parity is 1, if upper is 1, set answer to steps plus 1, set found to 1. If parity is 1, if upper is more than 1, if seen does not contain upper, Place upper into queue, Place (steps plus 1) into distances, Place upper into seen, add 1 to depth.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":398,"slug":"random-pick-index","title":"Random Pick Index","difficulty":"Medium","category":"Math","code":"The numbers is a list of 1, 2, 3, 3, and 3. The target is 3. The last is the last position of numbers. The total is 0.\nFor every spot from 0 to last.\nIf item spot of numbers is target, add 1 to total.\n\nThe wanted is total divided by 2. Add 1 to wanted. The seen is 0. The answer is 0.\nFor every spot from 0 to last.\nIf item spot of numbers is target, add 1 to seen. If item spot of numbers is target and seen is wanted, set answer to spot, break.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":399,"slug":"evaluate-division","title":"Evaluate Division","difficulty":"Medium","category":"Array","code":"Keep a shared lefts holding 0, 1, 1, and 2. Keep a shared rights holding 1, 0, 2, and 1. Keep a shared numerators holding 2, 1, 3, and 1. Keep a shared denominators holding 1, 2, 1, and 3. Keep a shared visited as an empty list of whole numbers.\nFor every spot from 0 to 4.\nPlace 0 into visited.\n\nKeep a shared known holding 1, 1, 1, 0, and 0.\n\nKeep a shared wantednode of 0. Keep a shared foundnum of 0. Keep a shared foundden of 0. Keep a shared done of 0. Keep a shared rendered as empty text.\n\nTo seek from node (a whole number) at num (a whole number) with den (a whole number). If done is 1, return. If node is wantednode, set foundnum to num, set foundden to den, set done to 1, return.\nFor every edge from 0 to 3.\nThe source is item edge of lefts. The dest is item edge of rights. The factor is 0. The divisor is 0.\nIf source is node and item dest of visited is 0.\nSet factor to item edge of numerators. Set divisor to item edge of denominators. Set item dest of visited to 1. The newnum is num times factor. The newden is den times divisor. Seek from dest at newnum with newden.\n\nTo expand from divisor (a whole number) with left (a whole number). If divisor is 0, return. The part is left divided by divisor. The piece is format whole number part as text. Place piece into rendered. The rest is left modulo divisor. Expand from divisor divided by 10 with rest.\n\nThe starts is a list of 0, 1, 0, 0, and 4. The ends is a list of 2, 0, 3, 0, and 4. The scaled is 0. The wholepart is 0. The fraction is 0. The marked is empty text. The allowed is 1.\nFor every query from 0 to 4.\nThe start is item query of starts. The end is item query of ends. Set wantednode to end. Set done to 0. Set foundnum to 0. Set foundden to 1. Set item 0 of visited to 0. Set item 1 of visited to 0. Set item 2 of visited to 0. Set item 3 of visited to 0. Set item 4 of visited to 0. Set item start of visited to 1. Set allowed to 1. If item start of known is 0, set allowed to 0. If allowed is 1, Seek from start at 1 with 1. Set rendered to empty text. If done is 1, set scaled to foundnum times 100000 divided by foundden. If done is 1, set wholepart to scaled divided by 100000. If done is 1, set fraction to scaled modulo 100000. If done is 1, set marked to format whole number wholepart as text. If done is 1, place marked into rendered. If done is 1, place \".\" into rendered. If done is 1, expand from 10000 with fraction. If done is 1, show rendered. If done is 0, show \"-1.00000\".\n","expected":"6.00000\n0.50000\n-1.00000\n1.00000\n-1.00000\n","step_budget":2000000},{"id":400,"slug":"nth-digit","title":"Nth Digit","difficulty":"Medium","category":"Math","code":"The position is 11. The width is 1. The start is 1. The count is 9.\nRepeat while position is more than count.\nSubtract count from position. Increase width by 1. Set start to start times 10. Set count to 9 times start.\n\nThe offset is position minus 1. The number is start plus (offset divided by width). The place is offset modulo width. The places is width minus 1. The value is number.\nFor every step from 0 to places.\nThe digit is value modulo 10. If step is places minus place, show digit, break. Set value to value divided by 10.\n","expected":"0\n","step_budget":2000000},{"id":401,"slug":"binary-watch","title":"Binary Watch","difficulty":"Easy","category":"Backtracking","code":"Keep a shared bits of 0.\nTo score from value (a whole number). If value is 0, return. The low is value modulo 2. Add low to bits. Score from value divided by 2.\n\nThe turned is 1.\nFor every hour from 0 to 11.\nFor every minute from 0 to 59.\nSet bits to 0. Score from hour. Score from minute.\nIf bits is turned.\nThe tens is minute divided by 10. The ones is minute modulo 10. The mins is format whole number tens as text. Place format whole number ones as text into mins. The line is format whole number hour as text. Place \":\" into line. Place mins into line. Show line.\n","expected":"0:01\n0:02\n0:04\n0:08\n0:16\n0:32\n1:00\n2:00\n4:00\n8:00\n","step_budget":2000000},{"id":402,"slug":"remove-k-digits","title":"Remove K Digits","difficulty":"Medium","category":"String","code":"Keep a shared number as empty text. Place \"1432219\" into number. Keep a shared removes of 3. Keep a shared chosen of 0.\nTo choose. Set chosen to -1. The last is the last position of number. The limit is last minus 1.\nFor every spot from 0 to limit.\nThe leftdigit is the digit value of character spot of number. The rightdigit is the digit value of character (spot plus 1) of number. If chosen is -1 and leftdigit is more than rightdigit, set chosen to spot.\n\nTo carve. Choose. The last is the last position of number. If chosen is -1, set chosen to last. The head is the slice of number from 0 to chosen. The tail is the slice of number from chosen plus 1 to last plus 1. The joined is empty text. Place head into joined. Place tail into joined. Set number to joined.\n\nFor every step from 1 to removes.\nCarve.\n\nThe size is the number of characters in number. The zero is character 0 of \"0\".\nRepeat while size is more than 1.\nThe first is character 0 of number. If first is not zero, break. The last is the last position of number. The joined is the slice of number from 1 to last plus 1. Set number to joined. Set size to the number of characters in number.\n\nShow number.\n","expected":"1219\n","step_budget":2000000},{"id":403,"slug":"frog-jump","title":"Frog Jump","difficulty":"Hard","category":"Array","code":"Keep a shared stones holding 0, 1, 3, 5, 6, 8, 12, and 17. Keep a shared seen as an empty list of whole numbers.\nFor every spot from 0 to 63.\nPlace 0 into seen.\n\nKeep a shared found of 0. Keep a shared good of 0.\nTo locate from target (a whole number) with spot (a whole number). If spot is more than 7, return. If item spot of stones is target, set found to spot, return. Locate from target with spot plus 1.\n\nTo walk from spot (a whole number) with jump (a whole number). If good is 1, return. If spot is 7, set good to 1, return. The mark is spot times 8 plus jump. If item mark of seen is 1, return. Set item mark of seen to 1. Expand from spot with jump.\n\nTo expand from spot (a whole number) with jump (a whole number). If good is 1, return. The low is jump minus 1. If low is more than 0, set found to -1. If low is more than 0, locate from item spot of stones plus low with 0. If low is more than 0 and found is at least 0, walk from found with low. The same is jump. Set found to -1. Locate from item spot of stones plus same with 0. If found is at least 0, walk from found with same. The high is jump plus 1. Set found to -1. Locate from item spot of stones plus high with 0. If found is at least 0, walk from found with high.\n\nWalk from 0 with 1. If good is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":404,"slug":"sum-of-left-leaves","title":"Sum of Left Leaves","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 3, 9, 20, 0, 0, 15, and 7. Keep a shared lefts holding 1, -1, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, -1, 6, -1, -1, -1, and -1.\n\nKeep a shared total of 0.\nTo visit from node (a whole number) with side (a whole number). If node is less than 0, return. The leftnode is item node of lefts. The rightnode is item node of rights. The amount is item node of values. If leftnode is -1 and rightnode is -1 and side is 1, add amount to total. Visit from leftnode with 1. Visit from rightnode with 0.\n\nVisit from 0 with 0. Show total.\n","expected":"24\n","step_budget":2000000},{"id":405,"slug":"convert-a-number-to-hexadecimal","title":"Convert a Number to Hexadecimal","difficulty":"Easy","category":"String","code":"The value is 26. The alphabet is \"0123456789abcdef\". The reversed is empty text.\nRepeat while value is more than 0.\nThe digit is value modulo 16. The piece is the slice of alphabet from digit to digit plus 1. Place piece into reversed. Set value to value divided by 16.\n\nThe size is the number of characters in reversed. If size is 0, Place \"0\" into reversed. The last is the last position of reversed. The result is empty text.\nFor every step from 0 to last.\nThe source is last minus step. The piece is the slice of reversed from source to source plus 1. Place piece into result.\n\nShow result.\n","expected":"1a\n","step_budget":2000000},{"id":406,"slug":"queue-reconstruction-by-height","title":"Queue Reconstruction by Height","difficulty":"Medium","category":"Array","code":"The heights is a list of 7, 4, 7, 5, 6, and 5. The ranks is a list of 0, 4, 1, 0, 1, and 2. The last is the last position of heights.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nThe taller is 0. If item right of heights is more than item left of heights, set taller to 1. If item right of heights is item left of heights and item right of ranks is less than item left of ranks, set taller to 1. If taller is 1, swap item left of heights and item right of heights, swap item left of ranks and item right of ranks.\n\nKeep a shared outheights as an empty list of whole numbers. Keep a shared outranks as an empty list of whole numbers.\nFor every spot from 0 to 5.\nPlace 0 into outheights. Place 0 into outranks.\n\nTo shift from spot (a whole number) with target (a whole number). If spot is at most target, return. Set item spot of outheights to item (spot minus 1) of outheights. Set item spot of outranks to item (spot minus 1) of outranks. Shift from spot minus 1 with target.\n\nThe placed is 0.\nFor every spot from 0 to last.\nThe seat is item spot of ranks. Shift from placed with seat. Set item seat of outheights to item spot of heights. Set item seat of outranks to item spot of ranks. Add 1 to placed.\n\nFor every spot from 0 to last.\nThe height is item spot of outheights. The rank is item spot of outranks. The line is format whole number height as text. Place \",\" into line. Place format whole number rank as text into line. Show line.\n","expected":"5,0\n7,0\n5,2\n6,1\n4,4\n7,1\n","step_budget":2000000},{"id":407,"slug":"trapping-rain-water-ii","title":"Trapping Rain Water II","difficulty":"Hard","category":"Array","code":"Keep a shared heights holding 1, 4, 3, 1, 3, 2, 3, 2, 1, 3, 2, 4, 2, 3, 3, 2, 3, and 1. Keep a shared levels as an empty list of whole numbers. Keep a shared changed of 0.\nFor every spot from 0 to 17.\nPlace 0 into levels.\n\nTo relax from spot (a whole number). The low is 100. The row is spot divided by 6. The column is spot modulo 6. If row is more than 0 and item (spot minus 6) of levels is less than low, set low to item (spot minus 6) of levels. If row is less than 2 and item (spot plus 6) of levels is less than low, set low to item (spot plus 6) of levels. If column is more than 0 and item (spot minus 1) of levels is less than low, set low to item (spot minus 1) of levels. If column is less than 5 and item (spot plus 1) of levels is less than low, set low to item (spot plus 1) of levels. If item spot of heights is more than low, set low to item spot of heights. If low is less than item spot of levels, set item spot of levels to low, set changed to 1.\n\nFor every spot from 0 to 17.\nSet item spot of levels to 100. The row is spot divided by 6. The column is spot modulo 6. If row is 0 or row is 2 or column is 0 or column is 5, set item spot of levels to item spot of heights.\n\nSet changed to 1.\nRepeat while changed is 1.\nSet changed to 0.\nFor every spot from 0 to 17.\nThe row is spot divided by 6. The column is spot modulo 6. The edge is 0. If row is 0 or row is 2 or column is 0 or column is 5, set edge to 1. If edge is 0, relax from spot.\n\nThe total is 0.\nFor every spot from 0 to 17.\nThe extra is item spot of levels minus item spot of heights. Add extra to total.\n\nShow total.\n","expected":"4\n","step_budget":2000000},{"id":409,"slug":"longest-palindrome","title":"Longest Palindrome","difficulty":"Easy","category":"String","code":"Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared target as empty text. Keep a shared found of 0.\nTo 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 is target, set found to spot, return. Search from spot plus 1.\n\nThe word is \"abccccdd\". The last is the last position of word. The counts is a list of 26 zeros.\nFor every spot from 0 to last.\nThe symbol is the slice of word from spot to spot plus 1. Set target to symbol. Set found to -1. Search from 0. The letter is found. Increase item letter of counts by 1.\n\nThe answer is 0.\nFor every spot from 0 to 25.\nThe amount is item spot of counts. The pairs is amount divided by 2. Add pairs times 2 to answer.\n\nThe extra is 0.\nFor every spot from 0 to 25.\nThe amount is item spot of counts. If amount modulo 2 is 1, set extra to 1.\n\nAdd extra to answer.\n\nShow answer.\n","expected":"7\n","step_budget":2000000},{"id":410,"slug":"split-array-largest-sum","title":"Split Array Largest Sum","difficulty":"Hard","category":"Array","code":"Keep a shared nums holding 7, 2, 5, 10, and 8. Keep a shared limit of 0. Keep a shared need of 0. Keep a shared used of 0. Keep a shared parts of 0.\nTo weigh from spot (a whole number). If spot is more than 4, set need to parts, return. The value is item spot of nums. The filled is used plus value. If filled is at most limit, set used to filled. If filled is at most limit, weigh from spot plus 1, return. Add 1 to parts. Set used to value. Weigh from spot plus 1.\n\nThe last is the last position of nums. The allowed is 2. The low is 0. The total is 0.\nFor every spot from 0 to last.\nThe value is item spot of nums. Add value to total. If value is more than low, set low to value.\n\nThe high is total.\nRepeat while low is less than high.\nThe middle is (low plus high) divided by 2. Set limit to middle. Set need to 0. Set used to 0. Set parts to 1. Weigh from 0. If need is at most allowed, set high to middle, otherwise set low to middle plus 1.\n\nShow low.\n","expected":"18\n","step_budget":2000000},{"id":412,"slug":"fizz-buzz","title":"Fizz Buzz","difficulty":"Easy","category":"String","code":"The count is 15.\nFor every number from 1 to count.\nIf number modulo 15 is 0, show \"FizzBuzz\". If number modulo 15 is not 0 and number modulo 3 is 0, show \"Fizz\". If number modulo 15 is not 0 and number modulo 5 is 0, show \"Buzz\". If number modulo 15 is not 0 and number modulo 3 is not 0 and number modulo 5 is not 0, show format whole number number as text.\n","expected":"1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n","step_budget":2000000},{"id":413,"slug":"arithmetic-slices","title":"Arithmetic Slices","difficulty":"Medium","category":"Array","code":"The nums is a list of 1, 2, 3, and 4. The last is the last position of nums. The run is 0. The total is 0.\nFor every spot from 2 to last.\nThe first is item (spot minus 1) of nums minus item (spot minus 2) of nums. The second is item spot of nums minus item (spot minus 1) of nums. If first is second, add 1 to run, otherwise set run to 0. Add run to total.\n\nShow total.\n","expected":"3\n","step_budget":2000000},{"id":414,"slug":"third-maximum-number","title":"Third Maximum Number","difficulty":"Easy","category":"Array","code":"The nums is a list of 3, 2, and 1. The first is -2000000000. The second is -2000000000. The third is -2000000000.\nFor each value in nums.\nIf value is more than first, set third to second, set second to first, set first to value. If value is less than first and value is more than second, set third to second, set second to value. If value is less than second and value is more than third, set third to value.\n\nIf third is -2000000000, show first, otherwise show third.\n","expected":"1\n","step_budget":2000000},{"id":415,"slug":"add-strings","title":"Add Strings","difficulty":"Easy","category":"String","code":"Keep a shared leftword as empty text. Place \"11\" into leftword. Keep a shared rightword as empty text. Place \"123\" into rightword. Keep a shared result as empty text. Keep a shared carry of 0.\nTo combine from first (a whole number) with second (a whole number). If first is less than 0 and second is less than 0 and carry is 0, return. The left is 0. The right is 0. If first is at least 0, set left to the digit value of character first of leftword. If second is at least 0, set right to the digit value of character second of rightword. The sum is left plus right plus carry. The digit is sum modulo 10. Set carry to sum divided by 10. Combine from first minus 1 with second minus 1. Place character digit of \"0123456789\" into result.\n\nThe firstlast is the last position of leftword. The secondlast is the last position of rightword. Combine from firstlast with secondlast. Show result.\n","expected":"134\n","step_budget":2000000},{"id":416,"slug":"partition-equal-subset-sum","title":"Partition Equal Subset Sum","difficulty":"Medium","category":"Array","code":"Keep a shared dp as an empty list of whole numbers. Keep a shared goal of 0.\nFor every spot from 0 to 11.\nPlace 0 into dp.\n\nSet item 0 of dp to 1.\n\nTo fill from spot (a whole number) with value (a whole number). If spot is less than value, return. The previous is item (spot minus value) of dp. If previous is 1, set item spot of dp to 1. Fill from spot minus 1 with value.\n\nThe nums is a list of 1, 5, 11, and 5. The total is 0. For each value in nums, add value to total. The half is total divided by 2. Set goal to half.\nFor each value in nums.\nFill from goal with value.\n\nThe parity is total modulo 2. The seat is goal. The found is item seat of dp. If parity is 1, set found to 0. If found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":417,"slug":"pacific-atlantic-water-flow","title":"Pacific Atlantic Water Flow","difficulty":"Medium","category":"Array","code":"Keep a shared heights holding 1, 2, 2, 3, 5, 3, 2, 3, 4, 4, 2, 4, 5, 3, 1, 6, 7, 1, 4, 5, 5, 1, 1, 2, and 4. Keep a shared pacific as an empty list of whole numbers. Keep a shared atlantic as an empty list of whole numbers.\nFor every spot from 0 to 24.\nPlace 0 into pacific. Place 0 into atlantic.\n\nTo climb from node (a whole number). If item node of pacific is 1, return. Set item node of pacific to 1. The row is node divided by 5. The column is node modulo 5. The height is item node of heights. If row is more than 0 and item (node minus 5) of heights is at least height, climb from node minus 5. If row is less than 4 and item (node plus 5) of heights is at least height, climb from node plus 5. If column is more than 0 and item (node minus 1) of heights is at least height, climb from node minus 1. If column is less than 4 and item (node plus 1) of heights is at least height, climb from node plus 1.\n\nTo wave from node (a whole number). If item node of atlantic is 1, return. Set item node of atlantic to 1. The row is node divided by 5. The column is node modulo 5. The height is item node of heights. If row is more than 0 and item (node minus 5) of heights is at least height, wave from node minus 5. If row is less than 4 and item (node plus 5) of heights is at least height, wave from node plus 5. If column is more than 0 and item (node minus 1) of heights is at least height, wave from node minus 1. If column is less than 4 and item (node plus 1) of heights is at least height, wave from node plus 1.\n\nFor every spot from 0 to 4.\nClimb from spot. Wave from 20 plus spot.\n\nFor every spot from 0 to 4.\nClimb from spot times 5. Wave from spot times 5 plus 4.\n\nFor every spot from 0 to 24.\nThe row is spot divided by 5. The column is spot modulo 5.\nIf item spot of pacific is 1 and item spot of atlantic is 1.\nThe line is format whole number row as text. Place \",\" into line. Place format whole number column as text into line. Show line.\n","expected":"0,4\n1,3\n1,4\n2,2\n3,0\n3,1\n4,0\n","step_budget":2000000},{"id":419,"slug":"battleships-in-a-board","title":"Battleships in a Board","difficulty":"Medium","category":"Array","code":"The board is a list of 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, and 1. The last is the last position of board. The ships is 0.\nFor every spot from 0 to last.\nThe row is spot divided by 4. The column is spot modulo 4. The top is 0. If row is 0, set top to 1. If row is more than 0 and item (spot minus 4) of board is 0, set top to 1. The left is 0. If column is 0, set left to 1. If column is more than 0 and item (spot minus 1) of board is 0, set left to 1. If item spot of board is 1 and top is 1 and left is 1, add 1 to ships.\n\nShow ships.\n","expected":"2\n","step_budget":2000000},{"id":420,"slug":"strong-password-checker","title":"Strong Password Checker","difficulty":"Hard","category":"String","code":"Keep a shared password as empty text. Keep a shared last of 0. Keep a shared run of 0. Keep a shared runs as an empty list of whole numbers. Keep a shared deletes of 0. Keep a shared wanted of 0. Keep a shared budget of 1. Keep a shared replacements of 0.\nTo measure from start (a whole number) with spot (a whole number). If spot is more than last, set run to spot minus start, return. The firstsymbol is the slice of password from start to start plus 1. The nextsymbol is the slice of password from spot to spot plus 1. If firstsymbol is nextsymbol, measure from start with spot plus 1, return. Set run to spot minus start.\n\nTo filter from spot (a whole number). The final is the last position of runs. If spot is more than final, return. The length is item spot of runs. The rest is length modulo 3. The triple is length divided by 3. The batch is deletes divided by budget. If triple is less than batch, set batch to triple. If rest is not wanted, set batch to 0. If batch is more than 0, subtract batch times budget from deletes, Set item spot of runs to length minus batch times budget. Filter from spot plus 1.\n\nTo score. Set replacements to 0.\nFor each part in runs.\nThe triples is part divided by 3. Add triples to replacements.\n\nPlace \"a\" into password. Set last to the last position of password. The size is last plus 1. The index is 0.\nRepeat while index is at most last.\nSet run to 0. Measure from index with index. Place run into runs. Add run to index.\n\nThe haslower is 0. The hasupper is 0. The hasdigit is 0.\nFor every spot from 0 to last.\nThe symbol is the slice of password from spot to spot plus 1. The code is character 0 of symbol. The lowlower is character 0 of \"a\". The highlower is character 0 of \"z\". The lowupper is character 0 of \"A\". The highupper is character 0 of \"Z\". The lowdigit is character 0 of \"0\". The highdigit is character 0 of \"9\". If code is at least lowlower and code is at most highlower, set haslower to 1. If code is at least lowupper and code is at most highupper, set hasupper to 1. If code is at least lowdigit and code is at most highdigit, set hasdigit to 1.\n\nThe missing is 3 minus haslower minus hasupper minus hasdigit. The answer is 0.\nIf size is less than 6.\nSet answer to 6 minus size. If missing is more than answer, set answer to missing.\n\nIf size is at least 6 and size is at most 20.\nScore. The extra is missing. If replacements is more than extra, set extra to replacements. Set answer to extra.\n\nIf size is more than 20.\nSet deletes to size minus 20. Set wanted to 0. Set budget to 1. Filter from 0. Set wanted to 1. Set budget to 2. Filter from 0. Set wanted to 2. Set budget to 3. Filter from 0. Score. The extra is missing. If replacements is more than extra, set extra to replacements. Set answer to size minus 20 plus extra.\n\nShow answer.\n","expected":"5\n","step_budget":2000000},{"id":421,"slug":"maximum-xor-of-two-numbers-in-an-array","title":"Maximum XOR of Two Numbers in an Array","difficulty":"Medium","category":"Array","code":"The nums is a list of 3, 10, 5, 25, 2, and 8. The last is the last position of nums. The best is 0.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nThe mixed is exclusive or of item left of nums and item right of nums. If mixed is more than best, set best to mixed.\n\nShow best.\n","expected":"28\n","step_budget":2000000},{"id":423,"slug":"reconstruct-original-digits-from-english","title":"Reconstruct Original Digits from English","difficulty":"Medium","category":"String","code":"Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared target as empty text. Keep a shared found of 0. Keep a shared result as empty text.\nTo 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 is target, set found to spot, return. Search from spot plus 1.\n\nTo emit from digit (a whole number) with times (a whole number). If times is 0, return. Place format whole number digit as text into result. Emit from digit with times minus 1.\n\nThe source is \"owoztneoer\". The counts is a list of 26 zeros. The last is the last position of source.\nFor every spot from 0 to last.\nThe symbol is the slice of source from spot to spot plus 1. Set target to symbol. Set found to -1. Search from 0. The letter is found. Increase item letter of counts by 1.\n\nThe zcount is item 25 of counts. The wcount is item 22 of counts. The ucount is item 20 of counts. The xcount is item 23 of counts. The gcount is item 6 of counts. The ocount is item 14 of counts. The hcount is item 7 of counts. The fcount is item 5 of counts. The scount is item 18 of counts. The icount is item 8 of counts.\n\nThe countzero is zcount. The counttwo is wcount. The countfour is ucount. The countsix is xcount. The counteight is gcount. The countone is ocount minus countzero minus counttwo minus countfour. The countthree is hcount minus counteight. The countfive is fcount minus countfour. The countseven is scount minus countsix. The countnine is icount minus countfive minus countsix minus counteight.\n\nEmit from 0 with countzero. Emit from 1 with countone. Emit from 2 with counttwo. Emit from 3 with countthree. Emit from 4 with countfour. Emit from 5 with countfive. Emit from 6 with countsix. Emit from 7 with countseven. Emit from 8 with counteight. Emit from 9 with countnine. Show result.\n","expected":"012\n","step_budget":2000000},{"id":424,"slug":"longest-repeating-character-replacement","title":"Longest Repeating Character Replacement","difficulty":"Medium","category":"String","code":"The word is \"ABAB\". The limit is 2. Keep a shared ordered as empty text. Keep a shared streak of 0. Keep a shared bestrun of 0.\nTo score from spot (a whole number) with last (a whole number). If spot is more than last, return. If character spot of ordered is character (spot minus 1) of ordered, add 1 to streak. If character spot of ordered is not character (spot minus 1) of ordered, set streak to 1. If streak is more than bestrun, set bestrun to streak. Score from spot plus 1 with last.\n\nThe last is the last position of word. The best is 1.\nFor every start from 0 to last.\nFor every finish from start to last.\nThe endpoint is finish plus 1. The piece is the slice of word from start to endpoint. Set ordered to sort characters of piece. The lastletter is the last position of ordered. Set streak to 1. Set bestrun to 1. Score from 1 with lastletter. The span is finish minus start plus 1. If span minus bestrun is at most limit and span is more than best, set best to span.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":427,"slug":"construct-quad-tree","title":"Construct Quad Tree","difficulty":"Medium","category":"Array","code":"Keep a shared grid holding 0, 1, 1, and 0. Keep a shared width of 2. Keep a shared buildsize of 0. Keep a shared uniform of 0. Keep a shared probevalue of 0.\nTo probe from row (a whole number) at column (a whole number) with spot (a whole number). The limit is buildsize times buildsize. If spot is at least limit, return. If uniform is 0, return. The down is spot divided by buildsize. The across is spot modulo buildsize. The actualrow is row plus down. The actualcolumn is column plus across. The cell is item (actualrow times width plus actualcolumn) of grid. If cell is not probevalue, set uniform to 0, return. Probe from row at column with spot plus 1.\n\nKeep a shared nodesleaf as an empty list of whole numbers. Keep a shared nodesvalue as an empty list of whole numbers. Keep a shared firsts as an empty list of whole numbers. Keep a shared seconds as an empty list of whole numbers. Keep a shared thirds as an empty list of whole numbers. Keep a shared fourths as an empty list of whole numbers. Keep a shared made of 0. Keep a shared parents as an empty list of whole numbers.\nTo build from top (a whole number) at left (a whole number) with size (a whole number). Set buildsize to size. Set uniform to 1. Set probevalue to item (top times width plus left) of grid. Probe from top at left with 0. The slot is made. Add 1 to made. Place uniform into nodesleaf. Place probevalue into nodesvalue. Place -1 into firsts. Place -1 into seconds. Place -1 into thirds. Place -1 into fourths. If uniform is 0, set item slot of nodesvalue to 1. If uniform is 1, return. If size is 1, return. The half is size divided by 2. Place slot into parents. The right is left plus half. The down is top plus half. Build from top at left with half. The child is made minus 1. The depth is the last position of parents. The host is item depth of parents. Set item host of firsts to child. Remove the last item from parents. Place slot into parents. Build from top at right with half. The child is made minus 1. The depth is the last position of parents. The host is item depth of parents. Set item host of seconds to child. Remove the last item from parents. Place slot into parents. Build from down at left with half. The child is made minus 1. The depth is the last position of parents. The host is item depth of parents. Set item host of thirds to child. Remove the last item from parents. Place slot into parents. Build from down at right with half. The child is made minus 1. The depth is the last position of parents. The host is item depth of parents. Set item host of fourths to child. Remove the last item from parents.\n\nBuild from 0 at 0 with 2. The line is empty text. Place \"[\" into line.\nFor every spot from 0 to made minus 1.\nIf spot is more than 0, Place \",\" into line. Place \"[\" into line. Place format whole number item spot of nodesleaf as text into line. Place \",\" into line. Place format whole number item spot of nodesvalue as text into line. Place \"]\" into line.\n\nPlace \"]\" into line. Show line.\n","expected":"[[0,1],[1,0],[1,1],[1,1],[1,0]]\n","step_budget":2000000},{"id":429,"slug":"n-ary-tree-level-order-traversal","title":"N-ary Tree Level Order Traversal","difficulty":"Medium","category":"Breadth-First Search","code":"Keep a shared values holding 1, 3, 2, 4, 5, and 6. Keep a shared nodeparents holding -1, 0, 0, 0, 1, and 1. Keep a shared queue as an empty list of whole numbers. Place 0 into queue. Keep a shared count of 1. Keep a shared nextcount of 0.\nTo expand from node (a whole number) with candidate (a whole number). If candidate is more than 5, return. If item candidate of nodeparents is node, Place candidate into queue, add 1 to count, add 1 to nextcount. Expand from node with candidate plus 1.\n\nThe head is 0. The remaining is 1. The line is empty text.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The piece is format whole number item node of values as text. If the length of line is more than 0, Place \",\" into line. Place piece into line. Expand from node with 0. Subtract 1 from remaining. If remaining is 0, Show line, set line to empty text, set remaining to nextcount, set nextcount to 0.\n","expected":"1\n3,2,4\n5,6\n","step_budget":2000000},{"id":430,"slug":"flatten-a-multilevel-doubly-linked-list","title":"Flatten a Multilevel Doubly Linked List","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12. Keep a shared nexts holding 1, 2, 3, 4, 5, -1, 7, 8, 9, -1, 11, and -1. Keep a shared childs holding -1, -1, 6, -1, -1, -1, -1, 10, -1, -1, -1, and -1. Keep a shared stack as an empty list of whole numbers. Keep a shared cursor of 0.\nTo unwind from marker (a whole number). If marker is less than 0, return. The depth is the last position of stack. If depth is less than 0, set cursor to -1, return. Set cursor to item depth of stack. Remove the last item from stack.\n\nThe result is an empty list of whole numbers. Set cursor to 0.\nRepeat while cursor is at least 0.\nPlace cursor into result. The spot is cursor. The kid is item spot of childs. The follow is item spot of nexts. If kid is at least 0 and follow is at least 0, Place follow into stack. If kid is at least 0, set cursor to kid. If kid is less than 0 and follow is at least 0, set cursor to follow. If kid is less than 0 and follow is less than 0, unwind from 0.\n\nThe line is empty text.\nFor each node in result.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number item node of values as text into line.\n\nShow line.\n","expected":"1,2,3,7,8,11,12,9,10,4,5,6\n","step_budget":2000000},{"id":433,"slug":"minimum-genetic-mutation","title":"Minimum Genetic Mutation","difficulty":"Medium","category":"String","code":"Keep a shared genes as an empty list of text. Place \"AACCGGTA\" into genes. Keep a shared firstgene as empty text. Keep a shared secondgene as empty text. Keep a shared apart of 0. Keep a shared seen as an empty list of whole numbers. Place 0 into seen. Keep a shared distance as an empty list of whole numbers. Place 0 into distance. Keep a shared queue as an empty list of whole numbers. Keep a shared count of 0.\nTo compare from spot (a whole number) with last (a whole number). If spot is more than last, return. If character spot of firstgene is not character spot of secondgene, add 1 to apart. Compare from spot plus 1 with last.\n\nTo expand from spot (a whole number) with candidate (a whole number). If candidate is more than 0, return. If item candidate of seen is 1, expand from spot with candidate plus 1, return. Set firstgene to item spot of genes. Set secondgene to item candidate of genes. Set apart to 0. Compare from 0 with 7. If apart is 1, set item candidate of seen to 1, set item candidate of distance to item spot of distance plus 1, Place candidate into queue, add 1 to count. Expand from spot with candidate plus 1.\n\nThe startgene is \"AACCGGTT\". The finishgene is \"AACCGGTA\". The answer is -1. If finishgene matches startgene, set answer to 0. Set count to 0.\nFor every spot from 0 to 0.\nSet firstgene to a copy of startgene. Set secondgene to item spot of genes. Set apart to 0. Compare from 0 with 7. If apart is 1, set item spot of seen to 1, set item spot of distance to 1, Place spot into queue, add 1 to count.\n\nThe head is 0.\nRepeat while head is less than count.\nThe spot is item head of queue. Add 1 to head. The gene is item spot of genes. The same is 0. If gene matches finishgene, set same to 1. If same is 1 and answer is -1, set answer to item spot of distance. Expand from spot with 0.\n\nShow answer.\n","expected":"1\n","step_budget":2000000},{"id":434,"slug":"number-of-segments-in-a-string","title":"Number of Segments in a String","difficulty":"Easy","category":"String","code":"The sentence is \"Hello, my name is John\". The last is the last position of sentence. The count is 0. The inside is 0.\nFor every spot from 0 to last.\nThe symbol is character spot of sentence. If symbol is \" \", set inside to 0. If symbol is not \" \" and inside is 0, add 1 to count, set inside to 1.\n\nShow count.\n","expected":"5\n","step_budget":2000000},{"id":435,"slug":"non-overlapping-intervals","title":"Non-overlapping Intervals","difficulty":"Medium","category":"Array","code":"Keep a shared starts holding 1, 2, 3, and 1. Keep a shared ends holding 2, 3, 4, and 3. Keep a shared keystart of 0. Keep a shared keyend of 0.\nTo shift from spot (a whole number) with marker (a whole number). If marker is less than 0, set item 0 of starts to keystart, set item 0 of ends to keyend, return. If item marker of ends is at most keyend, set item (spot plus 1) of starts to keystart, set item (spot plus 1) of ends to keyend, return. Set item (spot plus 1) of starts to item marker of starts. Set item (spot plus 1) of ends to item marker of ends. Shift from spot minus 1 with marker minus 1.\n\nFor every spot from 1 to 3.\nSet keystart to item spot of starts. Set keyend to item spot of ends. Shift from spot minus 1 with spot minus 1.\n\nThe lastend is item 0 of ends. The removals is 0.\nFor every spot from 1 to 3.\nIf item spot of starts is at least lastend, set lastend to item spot of ends, otherwise add 1 to removals.\n\nShow removals.\n","expected":"1\n","step_budget":2000000},{"id":436,"slug":"find-right-interval","title":"Find Right Interval","difficulty":"Medium","category":"Array","code":"Keep a shared starts holding 3, 2, and 1. Keep a shared ends holding 4, 3, and 2. Keep a shared beststart of 0. Keep a shared bestj of 0.\nTo search from spot (a whole number) with candidate (a whole number). If candidate is more than 2, return. If item candidate of starts is at least item spot of ends and item candidate of starts is less than beststart, set beststart to item candidate of starts, set bestj to candidate. Search from spot with candidate plus 1.\n\nThe answers is an empty list of whole numbers.\nFor every spot from 0 to 2.\nSet beststart to 1000000. Set bestj to -1. Search from spot with 0. Place bestj into answers.\n\nThe line is empty text.\nFor each answer in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number answer as text into line.\n\nShow line.\n","expected":"-1,0,1\n","step_budget":2000000},{"id":437,"slug":"path-sum-iii","title":"Path Sum III","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 10, 5, -3, 3, 2, 11, 3, -2, and 1. Keep a shared lefts holding 1, 3, -1, 6, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 5, 7, 8, -1, -1, -1, and -1. Keep a shared target of 0. Keep a shared found of 0.\nTo probe from node (a whole number) with total (a whole number). If node is less than 0, return. The sum is total plus item node of values. If sum is target, add 1 to found. Probe from item node of lefts with sum. Probe from item node of rights with sum.\n\nSet target to 8.\nFor every start from 0 to 8.\nProbe from start with 0.\n\nShow found.\n","expected":"3\n","step_budget":2000000},{"id":438,"slug":"find-all-anagrams-in-a-string","title":"Find All Anagrams in a String","difficulty":"Medium","category":"String","code":"The source is \"cbaebabacd\". The pattern is \"abc\". The target is sort characters of pattern. The size is 3. The laststart is 7. The answers is an empty list of whole numbers.\nFor every start from 0 to laststart.\nThe finish is start plus size. The piece is the slice of source from start to finish. The ordered is sort characters of piece. If ordered matches target, Place start into answers.\n\nThe line is empty text.\nFor each answer in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number answer as text into line.\n\nShow line.\n","expected":"0,6\n","step_budget":2000000},{"id":440,"slug":"k-th-smallest-in-lexicographical-order","title":"K-th Smallest in Lexicographical Order","difficulty":"Hard","category":"Trie","code":"Keep a shared parts as an empty list of text.\nFor every number from 1 to 13.\nThe piece is format whole number number as text. Place piece into parts.\n\nKeep a shared keytext as empty text.\nTo shift from spot (a whole number) with marker (a whole number). If spot is less than 0, set item 0 of parts to keytext, return. The other is item spot of parts. If keytext comes before other, set item (spot plus 1) of parts to other, shift from spot minus 1 with marker, return. Set item (spot plus 1) of parts to keytext.\n\nFor every spot from 1 to 12.\nSet keytext to item spot of parts. Shift from spot minus 1 with 0.\n\nThe rank is 2. The position is rank minus 1. Show item position of parts.\n","expected":"10\n","step_budget":2000000},{"id":441,"slug":"arranging-coins","title":"Arranging Coins","difficulty":"Easy","category":"Math","code":"The coins is 5. The remaining is coins. The rowcount is 0. The need is 1.\nRepeat while remaining is at least need.\nSubtract need from remaining. Add 1 to rowcount. Add 1 to need.\n\nShow rowcount.\n","expected":"2\n","step_budget":2000000},{"id":442,"slug":"find-all-duplicates-in-an-array","title":"Find All Duplicates in an Array","difficulty":"Medium","category":"Array","code":"Keep a shared nums holding 4, 3, 2, 7, 8, 2, 3, and 1. Keep a shared tally of 0. Keep a shared earlierfound of 0. Keep a shared origin of 0.\nTo tally from spot (a whole number) with value (a whole number). If spot is more than 7, return. If item spot of nums is value, add 1 to tally. Tally from spot plus 1 with value.\n\nTo earlier from spot (a whole number) with value (a whole number). If spot is at least origin, return. If item spot of nums is value, set earlierfound to 1, return. Earlier from spot plus 1 with value.\n\nThe answers is an empty list of whole numbers.\nFor every spot from 0 to 7.\nThe value is item spot of nums. Set tally to 0. Set origin to spot. Tally from 0 with value. If tally is more than 1, set earlierfound to 0. If tally is more than 1, earlier from 0 with value. If tally is more than 1 and earlierfound is 0, Place value into answers.\n\nSort answers. The line is empty text.\nFor each answer in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number answer as text into line.\n\nShow line.\n","expected":"2,3\n","step_budget":2000000},{"id":443,"slug":"string-compression","title":"String Compression","difficulty":"Medium","category":"String","code":"Keep a shared chars holding \"a\", \"a\", \"b\", \"b\", \"c\", \"c\", and \"c\". Keep a shared symbol as empty text. Keep a shared run of 0.\nTo count from spot (a whole number) with next (a whole number). If next is more than 6, return. If item next of chars matches symbol, add 1 to run, count from spot with next plus 1.\n\nThe result is empty text. The spot is 0.\nRepeat while spot is at most 6.\nSet symbol to item spot of chars. Set run to 1. Count from spot with spot plus 1. Place symbol into result. If run is more than 1, Place format whole number run as text into result. Add run to spot.\n\nThe lastresult is the last position of result. The size is lastresult plus 1. Show size.\n","expected":"6\n","step_budget":2000000},{"id":445,"slug":"add-two-numbers-ii","title":"Add Two Numbers II","difficulty":"Medium","category":"Math","code":"The firstdigits is a list of 7, 2, 4, and 3. The seconddigits is a list of 5, 6, and 4. The first is 0.\nFor each digit in firstdigits.\nSet first to first times 10 plus digit.\n\nThe second is 0.\nFor each digit in seconddigits.\nSet second to second times 10 plus digit.\n\nThe total is first plus second. The digits is an empty list of whole numbers.\nRepeat while total is more than 0.\nThe digit is total modulo 10. Place digit into digits. Set total to total divided by 10.\n\nThe last is the last position of digits. The line is empty text.\nFor every step from 0 to last.\nThe spot is last minus step. If the length of line is more than 0, Place \",\" into line. Place format whole number item spot of digits as text into line.\n\nShow line.\n","expected":"7,8,0,7\n","step_budget":2000000},{"id":446,"slug":"arithmetic-slices-ii-subsequence","title":"Arithmetic Slices II - Subsequence","difficulty":"Hard","category":"Array","code":"Keep a shared nums holding 2, 4, 6, 8, and 10. Keep a shared powers holding 1, 2, 4, 8, and 16. Keep a shared chosen holding 0, 0, 0, 0, and 0. Keep a shared chosenlen of 0. Keep a shared gap of 0. Keep a shared good of 0. Keep a shared total of 0.\nTo collect from mask (a whole number) with spot (a whole number). If spot is more than 4, return. The flag is bitwise and of mask and item spot of powers. If flag is more than 0, The here is chosenlen, set item here of chosen to item spot of nums, add 1 to chosenlen. Collect from mask with spot plus 1.\n\nTo verify from spot (a whole number) with last (a whole number). If spot is more than last, return. The gapnow is item spot of chosen minus item (spot minus 1) of chosen. If gapnow is not gap, set good to 0. Verify from spot plus 1 with last.\n\nTo evaluate from mask (a whole number). Set chosenlen to 0. Collect from mask with 0. If chosenlen is at least 3, set gap to item 1 of chosen minus item 0 of chosen. If chosenlen is at least 3, set good to 1. If chosenlen is at least 3, verify from 2 with chosenlen minus 1. If chosenlen is at least 3 and good is 1, add 1 to total.\n\nFor every mask from 1 to 31.\nEvaluate from mask.\n\nShow total.\n","expected":"7\n","step_budget":2000000},{"id":447,"slug":"number-of-boomerangs","title":"Number of Boomerangs","difficulty":"Medium","category":"Array","code":"Keep a shared xs holding 0, 1, and 2. Keep a shared ys holding 0, 0, and 0. Keep a shared dist of 0. Keep a shared pairdistance of 0. Keep a shared matches of 0. Keep a shared total of 0.\nTo measure from first (a whole number) with second (a whole number). The dx is item first of xs minus item second of xs. The dy is item first of ys minus item second of ys. Set dist to dx times dx plus dy times dy.\n\nTo scan from anchor (a whole number) at other (a whole number) with marker (a whole number). If marker is more than 2, return. If marker is anchor, scan from anchor at other with marker plus 1, return. If marker is other, scan from anchor at other with marker plus 1, return. Measure from anchor with marker. The d2 is dist. If d2 is pairdistance, add 1 to matches. Scan from anchor at other with marker plus 1.\n\nTo prepare from anchor (a whole number) with other (a whole number). If other is more than 2, return. If other is anchor, prepare from anchor with other plus 1, return. Measure from anchor with other. Set pairdistance to dist. Set matches to 0. Scan from anchor at other with 0. Add matches to total. Prepare from anchor with other plus 1.\n\nFor every anchor from 0 to 2.\nPrepare from anchor with 0.\n\nShow total.\n","expected":"2\n","step_budget":2000000},{"id":448,"slug":"find-all-numbers-disappeared-in-an-array","title":"Find All Numbers Disappeared in an Array","difficulty":"Easy","category":"Array","code":"Keep a shared nums holding 4, 3, 2, 7, 8, 2, 3, and 1. Keep a shared tally of 0.\nTo seek from spot (a whole number) with value (a whole number). If spot is more than 7, return. If item spot of nums is value, add 1 to tally. Seek from spot plus 1 with value.\n\nThe answers is an empty list of whole numbers.\nFor every value from 1 to 8.\nSet tally to 0. Seek from 0 with value. If tally is 0, Place value into answers.\n\nThe line is empty text.\nFor each answer in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number answer as text into line.\n\nShow line.\n","expected":"5,6\n","step_budget":2000000},{"id":450,"slug":"delete-node-in-a-bst","title":"Delete Node in a BST","difficulty":"Medium","category":"Tree","code":"Keep a shared values holding 5, 3, 6, 2, 4, and 7. Keep a shared lefts holding 1, 3, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 5, -1, -1, and -1. Keep a shared root of 0. Keep a shared side of 0. Keep a shared spot of 0. Keep a shared parent of 0. Keep a shared key of 0. Keep a shared pieces as an empty list of text. Keep a shared successor of 0. Keep a shared before of 0.\nTo attach from above (a whole number) with child (a whole number). If above is less than 0, set root to child, return. If side is 0, set item above of lefts to child, return. Set item above of rights to child.\n\nTo descend from node (a whole number) with candidate (a whole number). Set successor to candidate. Set before to node. If item candidate of lefts is less than 0, return. Descend from candidate with item candidate of lefts.\n\nTo prune from node (a whole number) with above (a whole number). The replacement is 0. If item node of lefts is less than 0, set replacement to item node of rights. If item node of lefts is less than 0, attach from above with replacement. If item node of lefts is less than 0, return. If item node of rights is less than 0, set replacement to item node of lefts. If item node of rights is less than 0, attach from above with replacement. If item node of rights is less than 0, return. Set successor to item node of rights. Set before to node. Descend from node with item node of rights. The heirspot is successor. Set item node of values to item heirspot of values. The heir is item heirspot of rights. If before is node, set item node of rights to heir, otherwise set item before of lefts to heir.\n\nTo record from node (a whole number). The piece is format whole number item node of values as text. Place piece into pieces.\n\nSet key to 3. Set spot to 0. Set parent to -1. Set side to 0.\nRepeat while spot is at least 0.\nThe here is spot. If item here of values is key, break. Set parent to spot. If key is less than item here of values, set side to 0, set spot to item here of lefts. If key is more than item here of values, set side to 1, set spot to item here of rights.\n\nIf spot is at least 0, prune from spot with parent. The queue is an empty list of whole numbers. Place root into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe 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, record from node. If node is at least 0, Place item node of lefts into queue. If node is at least 0, Place item node of rights into queue. If node is at least 0, add 2 to count.\n\nRepeat while the last position of pieces is at least 0.\nThe 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 break.\n\nThe line is join pieces with \",\". Show line.\n","expected":"5,4,6,2,null,null,7\n","step_budget":2000000},{"id":451,"slug":"sort-characters-by-frequency","title":"Sort Characters By Frequency","difficulty":"Medium","category":"String","code":"The word is \"tree\". The sorted is sort characters of word. The last is the last position of sorted. The letters is an empty list of text. The counts is an empty list of whole numbers. The current is the slice of sorted from 0 to 1. Place current into letters. Place 0 into counts. The runspot is 0.\nFor every spot from 0 to last.\nThe piece is the slice of sorted from spot to spot plus 1. If piece matches current, set item runspot of counts to item runspot of counts plus 1. If piece does not match current, add 1 to runspot, set current to piece, Place piece into letters, Place 1 into counts.\n\nThe lastrun is the last position of counts.\nFor every left from 0 to lastrun.\nFor every right from left plus 1 to lastrun.\nIf item right of counts is more than item left of counts, swap item left of counts and item right of counts, swap item left of letters and item right of letters.\n\nKeep a shared result as empty text. Keep a shared symbol as empty text.\nTo emit from times (a whole number). If times is 0, return. Place symbol into result. Emit from times minus 1.\n\nFor every spot from 0 to lastrun.\nSet symbol to item spot of letters. Emit from item spot of counts.\n\nShow result.\n","expected":"eert\n","step_budget":2000000},{"id":452,"slug":"minimum-number-of-arrows-to-burst-balloons","title":"Minimum Number of Arrows to Burst Balloons","difficulty":"Medium","category":"Array","code":"The starts is a list of 10, 2, 1, and 7. The ends is a list of 16, 8, 6, and 12. The last is the last position of starts.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nIf item right of ends is less than item left of ends, swap item left of ends and item right of ends, swap item left of starts and item right of starts.\n\nThe arrows is 1. The reach is item 0 of ends.\nFor every spot from 1 to last.\nIf item spot of starts is more than reach, add 1 to arrows, set reach to item spot of ends.\n\nShow arrows.\n","expected":"2\n","step_budget":2000000},{"id":453,"slug":"minimum-moves-to-equal-array-elements","title":"Minimum Moves to Equal Array Elements","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 2, and 3. The last is the last position of numbers. The size is last plus 1. The total is 0. The smallest is item 0 of numbers.\nFor each value in numbers.\nAdd value to total. If value is less than smallest, set smallest to value.\n\nThe moves is total minus smallest times size. Show moves.\n","expected":"3\n","step_budget":2000000},{"id":454,"slug":"4sum-ii","title":"4Sum II","difficulty":"Medium","category":"Array","code":"The firsts is a list of 1, and 2. The seconds is a list of -2, and -1. The thirds is a list of -1, and 2. The fourths is a list of 0, and 2. The last is the last position of firsts. The found is 0.\nFor every alpha from 0 to last.\nFor every beta from 0 to last.\nFor every gamma from 0 to last.\nFor every delta from 0 to last.\nThe total is item alpha of firsts plus item beta of seconds plus item gamma of thirds plus item delta of fourths. If total is 0, add 1 to found.\n\nShow found.\n","expected":"2\n","step_budget":2000000},{"id":455,"slug":"assign-cookies","title":"Assign Cookies","difficulty":"Easy","category":"Array","code":"The greed is a list of 1, 2, and 3. The sizes is a list of 1, and 1. The lastg is the last position of greed. The lasts is the last position of sizes. Sort greed. Sort sizes. The child is 0. The cookie is 0.\nRepeat while child is at most lastg and cookie is at most lasts.\nIf item cookie of sizes is at least item child of greed, add 1 to child. Add 1 to cookie.\n\nShow child.\n","expected":"1\n","step_budget":2000000},{"id":456,"slug":"132-pattern","title":"132 Pattern","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 2, 3, and 4. The last is the last position of numbers. The found is 0.\nFor every first from 0 to last.\nFor every second from first plus 1 to last.\nFor every third from second plus 1 to last.\nIf item first of numbers is less than item third of numbers and item third of numbers is less than item second of numbers, set found to 1.\n\nIf found is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":457,"slug":"circular-array-loop","title":"Circular Array Loop","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 2, -1, 1, 2, and 2. Keep a shared found of 0.\nTo seek from start (a whole number) with cap (a whole number). The direction is item start of numbers. The current is start. The next is 0. The steps is 0.\nRepeat while steps is less than cap.\nThe move is item current of numbers. The samedir is 1. If direction is more than 0 and move is less than 0, set samedir to 0. If direction is less than 0 and move is more than 0, set samedir to 0. If samedir is 0, set steps to cap. If samedir is 1, set next to current plus move. If samedir is 1 and next is less than 0, add cap to next. If samedir is 1 and next is at least cap, subtract cap from next. If samedir is 1 and next is current, set steps to cap. If samedir is 1 and next is start and steps is more than 0, set found to 1, set steps to cap. If samedir is 1 and next is not current and next is not start, set current to next, add 1 to steps.\n\nThe last is the last position of numbers. The cap is last plus 1.\nFor every start from 0 to last.\nSeek from start with cap.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":458,"slug":"poor-pigs","title":"Poor Pigs","difficulty":"Hard","category":"Math","code":"The buckets is 1000. The die is 15. The window is 60. The rounds is window divided by die. The base is rounds plus 1. The pigs is 0. The covered is 1.\nRepeat while covered is less than buckets.\nSet covered to covered times base. Add 1 to pigs.\n\nShow pigs.\n","expected":"5\n","step_budget":2000000},{"id":459,"slug":"repeated-substring-pattern","title":"Repeated Substring Pattern","difficulty":"Easy","category":"String","code":"The word is \"abab\". The longer is the length of word. The last is the last position of word. The found is 0.\nFor every width from 1 to last.\nThe same is 1. If the longer modulo width is not 0, set same to -1.\nFor every spot from 0 to last.\nThe other is spot modulo width. If same is 1 and character spot of word is not character other of word, set same to 0. If same is 1 and spot is last, set found to 1.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":461,"slug":"hamming-distance","title":"Hamming Distance","difficulty":"Easy","category":"Bit Manipulation","code":"The first is 1. The second is 4. The mixed is exclusive or of first and second. The count is 0.\nRepeat while mixed is more than 0.\nThe bit is bitwise and of mixed and 1. Add bit to count. Set mixed to shift mixed right by 1.\n\nShow count.\n","expected":"2\n","step_budget":2000000},{"id":462,"slug":"minimum-moves-to-equal-array-elements-ii","title":"Minimum Moves to Equal Array Elements II","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 2, and 3. Sort numbers. The last is the last position of numbers. The middle is last divided by 2. The median is item middle of numbers. The moves is 0.\nFor each value in numbers.\nThe diff is value minus median. If diff is less than 0, set diff to 0 minus diff. Add diff to moves.\n\nShow moves.\n","expected":"2\n","step_budget":2000000},{"id":463,"slug":"island-perimeter","title":"Island Perimeter","difficulty":"Easy","category":"Array","code":"The cells is a list of 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, and 0. The last is 3. The side is 4. The perimeter is 0.\nFor every row from 0 to last.\nFor every column from 0 to last.\nThe spot is row times side plus column.\nIf item spot of cells is 1.\nAdd 4 to perimeter. If row is more than 0 and item (spot minus side) of cells is 1, subtract 1 from perimeter. If row is less than last and item (spot plus side) of cells is 1, subtract 1 from perimeter. If column is more than 0 and item (spot minus 1) of cells is 1, subtract 1 from perimeter. If column is less than last and item (spot plus 1) of cells is 1, subtract 1 from perimeter.\n\nShow perimeter.\n","expected":"16\n","step_budget":2000000},{"id":464,"slug":"can-i-win","title":"Can I Win","difficulty":"Medium","category":"Math","code":"Keep a shared known as an empty list of whole numbers. Keep a shared won as an empty list of whole numbers. Keep a shared answer of 0. Keep a shared maxchoice of 10.\nFor every spot from 0 to 1023.\nPlace 0 into known. Place 0 into won.\n\nTo search from mask (a whole number) with remaining (a whole number). The good is 0. If item mask of known is 1, set answer to item mask of won, return. Set item mask of known to 1.\nFor every value from 1 to maxchoice.\nThe offset is value minus 1. The bit is shift 1 left by offset. The taken is bitwise and of mask and bit. If good is 0 and taken is 0 and value is at least remaining, set good to 1. If good is 0 and taken is 0 and value is less than remaining, search from mask plus bit with remaining minus value. If good is 0 and answer is 0 and taken is 0 and value is less than remaining, set good to 1. Set item mask of won to good. Set answer to good.\n\nSearch from 0 with 11. If answer is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":466,"slug":"count-the-repetitions","title":"Count The Repetitions","difficulty":"Hard","category":"String","code":"The first is \"acb\". The second is \"ab\". The firsttimes is 4. The secondtimes is 2. The long is empty text.\nFor every round from 1 to firsttimes.\nPlace first into long.\n\nThe needle is a copy of second. The lastlong is the last position of long. The lastneedle is the last position of needle. The cursor is 0. The full is 0.\nFor every spot from 0 to lastlong.\nIf character spot of long is character cursor of needle, add 1 to cursor. If cursor is more than lastneedle, set cursor to 0, add 1 to full.\n\nThe answer is full divided by secondtimes. Show answer.\n","expected":"2\n","step_budget":2000000},{"id":467,"slug":"unique-substrings-in-wraparound-string","title":"Unique Substrings in Wraparound String","difficulty":"Medium","category":"String","code":"Keep a shared word as empty text. Place \"zab\" into word. Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared target as empty text. Keep a shared foundat of 0.\nTo locate from spot (a whole number). If spot is more than 25, return. The symbol is the slice of alphabet from spot to spot plus 1. If symbol matches target, set foundat to spot, return. Locate from spot plus 1.\n\nKeep a shared piece as empty text. Keep a shared run of 1. Keep a shared nextindex of 0. Keep a shared expected as empty text.\nTo step from spot (a whole number). If spot is 0, return. Set piece to the slice of word from spot to spot plus 1. Set target to the slice of word from spot minus 1 to spot. Set foundat to -1. Locate from 0. Set nextindex to foundat plus 1. If nextindex is 26, set nextindex to 0. Set expected to the slice of alphabet from nextindex to nextindex plus 1. If piece matches expected, add 1 to run, return. Set run to 1.\n\nKeep a shared letters as an empty list of text. Keep a shared bests as an empty list of whole numbers. Keep a shared spotfound of 0.\nTo record from spot (a whole number). If spot is more than the last position of letters, return. If item spot of letters matches piece, set spotfound to spot, return. Record from spot plus 1.\n\nTo lift from spot (a whole number). If run is more than item spot of bests, set item spot of bests to run.\n\nThe last is the last position of word.\nFor every spot from 0 to last.\nIf spot is more than 0, step from spot. Set piece to the slice of word from spot to spot plus 1. Set spotfound to -1. Record from 0. If spotfound is less than 0, Place piece into letters, Place run into bests. If spotfound is at least 0, lift from spotfound.\n\nThe total is 0.\nFor each value in bests.\nAdd value to total.\n\nShow total.\n","expected":"6\n","step_budget":2000000},{"id":468,"slug":"validate-ip-address","title":"Validate IP Address","difficulty":"Medium","category":"String","code":"Keep a shared parts as an empty list of text. Set parts to split \"172.16.254.1\" by \".\". Keep a shared parts6 as an empty list of text. Set parts6 to split \"172.16.254.1\" by \":\". Keep a shared bad of 0. Keep a shared bad6 of 0.\nTo check from spot (a whole number) with cap (a whole number). If spot is at least cap, return. If bad is 1, return. The part is item spot of parts. The size is the length of part. If size is less than 1, set bad to 1. If size is more than 3, set bad to 1. If size is more than 1 and character 0 of part is \"0\", set bad to 1. The total is 0.\nFor every index from 0 to size minus 1.\nThe symbol is character index of part. The isnum is 0. The value is the digit value of symbol. If symbol is between \"0\" and \"9\", set isnum to 1. If isnum is 0, set bad to 1. If isnum is 1, set total to total times 10 plus value. If total is more than 255, set bad to 1. If index is size minus 1, check from spot plus 1 with cap.\n\nTo verify from spot (a whole number) with cap (a whole number). If spot is at least cap, return. If bad6 is 1, return. The part is item spot of parts6. The size is the length of part. If size is less than 1, set bad6 to 1. If size is more than 4, set bad6 to 1.\nFor every index from 0 to size minus 1.\nThe symbol is character index of part. The ishex is 0. If symbol is between \"0\" and \"9\", set ishex to 1. If symbol is between \"a\" and \"f\", set ishex to 1. If symbol is between \"A\" and \"F\", set ishex to 1. If ishex is 0, set bad6 to 1. If index is size minus 1, verify from spot plus 1 with cap.\n\nThe last is the last position of parts. The count is last plus 1. The last6 is the last position of parts6. The count6 is last6 plus 1. Check from 0 with count. Verify from 0 with count6. The is4 is 0. If count is 4 and bad is 0, set is4 to 1. If is4 is 1, show \"IPv4\". If is4 is 0 and count6 is 8 and bad6 is 0, show \"IPv6\". If is4 is 0 and count6 is not 8, show \"Neither\". If is4 is 0 and count6 is 8 and bad6 is 1, show \"Neither\".\n","expected":"IPv4\n","step_budget":2000000},{"id":470,"slug":"implement-rand10-using-rand7","title":"Implement Rand10() Using Rand7()","difficulty":"Medium","category":"Math","code":"Keep a shared state of 0. Keep a shared value of 0. Keep a shared group of 0. Keep a shared result of 0.\nTo roll. Increase state by 1. If state is more than 7, set state to 1.\n\nTo draw. Set value to 0.\nRepeat while value is less than 1 or value is more than 40.\nRoll. Set group to state minus 1. Roll. Set value to group times 7 plus state. Set result to (value minus 1) modulo 10 plus 1.\n\nDraw. Show result.\n","expected":"2\n","step_budget":2000000},{"id":472,"slug":"concatenated-words","title":"Concatenated Words","difficulty":"Hard","category":"Array","code":"Keep a shared words holding \"cat\", \"cats\", \"catsdogcats\", \"dog\", \"dogcatsdog\", \"hippopotamuses\", \"rat\", and \"ratcatdogcat\". Keep a shared source as empty text. Keep a shared skipindex of 0. Keep a shared segok of 0. Keep a shared last of 0. The endword is the last position of words. Set last to endword.\nTo segment from start (a whole number) with pieces (a whole number). The end is the last position of source. The extent is end plus 1. If segok is 1, return. If start is extent and pieces is at least 2, set segok to 1. If start is extent, return.\nFor every index from 0 to last.\nThe word is item index of words. The endword is the last position of word. The size is endword plus 1.\nIf index is not skipindex and start plus size is at most extent.\nSet piece to the slice of source from start to start plus size.\nIf piece matches word.\nSegment from start plus size with pieces plus 1.\n\nFor every index from 0 to last.\nSet source to item index of words. Set skipindex to index. Set segok to 0. Segment from 0 with 0. If segok is 1, show source.\n","expected":"catsdogcats\ndogcatsdog\nratcatdogcat\n","step_budget":2000000},{"id":473,"slug":"matchsticks-to-square","title":"Matchsticks to Square","difficulty":"Medium","category":"Array","code":"Keep a shared sticks holding 1, 1, 2, 2, and 2. Keep a shared sides holding 0, 0, 0, and 0. Keep a shared squareok of 0. Keep a shared target of 0. The whole is 0.\nFor each stick in sticks.\nAdd stick to whole.\n\nSet target to whole divided by 4. Keep a shared last of 0. The end is the last position of sticks. Set last to end.\nTo place from spot (a whole number). If squareok is 1, return. If spot is more than last, set squareok to 1, return. The value is item spot of sticks.\nFor every side from 0 to 3.\nThe total is item side of sides plus value.\nIf squareok is 0 and total is at most target.\nSet item side of sides to total. Place from spot plus 1. Decrease item side of sides by value. If squareok is 1, return.\n\nPlace from 0. If squareok is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":474,"slug":"ones-and-zeroes","title":"Ones and Zeroes","difficulty":"Medium","category":"Array","code":"Keep a shared words holding \"10\", \"0001\", \"111001\", \"1\", and \"0\". Keep a shared zeros as an empty list of whole numbers. Keep a shared ones as an empty list of whole numbers. Keep a shared current as empty text. Keep a shared zcount of 0. Keep a shared ocount of 0.\nTo measure from spot (a whole number) with limit (a whole number). If spot is more than limit, return. If character spot of current is \"0\", add 1 to zcount. If character spot of current is \"1\", add 1 to ocount. Measure from spot plus 1 with limit.\n\nKeep a shared last of 0. The endword is the last position of words. Set last to endword.\nFor every index from 0 to last.\nSet current to item index of words. Set zcount to 0. Set ocount to 0. The limit is the last position of current. Measure from 0 with limit. Place zcount into zeros. Place ocount into ones.\n\nKeep a shared best of 0. Keep a shared maxzeros of 5. Keep a shared maxones of 3. Keep a shared usedzeros of 0. Keep a shared usedones of 0.\nTo walk from spot (a whole number) with taken (a whole number). If spot is more than last and taken is more than best, set best to taken. If spot is more than last, return. Walk from spot plus 1 with taken. The zcost is item spot of zeros. The ocost is item spot of ones.\nIf usedzeros plus zcost is at most maxzeros and usedones plus ocost is at most maxones.\nAdd zcost to usedzeros. Add ocost to usedones. Walk from spot plus 1 with taken plus 1. Subtract zcost from usedzeros. Subtract ocost from usedones.\n\nWalk from 0 with 0. Show best.\n","expected":"4\n","step_budget":2000000},{"id":475,"slug":"heaters","title":"Heaters","difficulty":"Medium","category":"Array","code":"Keep a shared heaters as an empty list of whole numbers. Place 2 into heaters. Keep a shared nearest of 0. Keep a shared gap of 0.\nTo score with house (a whole number). Set nearest to 1000000.\nFor each heater in heaters.\nSet gap to house minus heater. Set gap to the absolute value of gap. If gap is less than nearest, set nearest to gap.\n\nThe houses is a list of 1, 2, 3. The far is 0.\nFor each house in houses.\nScore with house. If nearest is more than far, set far to nearest.\n\nShow far.\n","expected":"1\n","step_budget":2000000},{"id":476,"slug":"number-complement","title":"Number Complement","difficulty":"Easy","category":"Bit Manipulation","code":"The value is 5. The mask is 1.\nRepeat while mask is at most value.\nSet mask to mask times 2.\n\nThe flipped is mask minus 1 minus value. Show flipped.\n","expected":"2\n","step_budget":2000000},{"id":477,"slug":"total-hamming-distance","title":"Total Hamming Distance","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 4, 14, and 2. Keep a shared total of 0. Keep a shared mixed of 0.\nTo score with first (a whole number) with second (a whole number). Set mixed to exclusive or of item first of numbers and item second of numbers.\nRepeat while mixed is more than 0.\nThe low is bitwise and of mixed and 1. If low is 1, add 1 to total. Set mixed to shift mixed right by 1.\n\nThe last is the last position of numbers.\nFor every first from 0 to last.\nFor every second from first plus 1 to last.\nScore with first with second.\n\nShow total.\n","expected":"6\n","step_budget":2000000},{"id":478,"slug":"generate-random-point-in-a-circle","title":"Generate Random Point in a Circle","difficulty":"Medium","category":"Math","code":"The seed is 2026. The east is 0. The north is 0. The accepted is 0.\nRepeat while accepted is 0.\nSet seed to seed times 1103515245 plus 12345. Set seed to seed modulo 2147483648. Set east to seed modulo 200001 minus 100000. Set seed to seed times 1103515245 plus 12345. Set seed to seed modulo 2147483648. Set north to seed modulo 200001 minus 100000. The reach is east times east plus north times north. If reach is at most 10000000000, set accepted to 1.\n\nThe eastparts is an empty list of text. The eastsize is the absolute value of east. The eastwhole is eastsize divided by 100000. The eastfraction is eastsize modulo 100000. If east is less than 0, Place \"-\" into eastparts. The easthead is format whole number eastwhole as text. Place easthead into eastparts. Place \".\" into eastparts. The divisor is 10000.\nFor every digit from 0 to 4.\nThe part is eastfraction divided by divisor modulo 10. The parttext is format whole number part as text. Place parttext into eastparts. Set divisor to divisor divided by 10.\n\nThe easttext is join eastparts with \"\". The northparts is an empty list of text. The northsize is the absolute value of north. The northwhole is northsize divided by 100000. The northfraction is northsize modulo 100000. If north is less than 0, Place \"-\" into northparts. The northhead is format whole number northwhole as text. Place northhead into northparts. Place \".\" into northparts. Set divisor to 10000.\nFor every digit from 0 to 4.\nThe part is northfraction divided by divisor modulo 10. The parttext is format whole number part as text. Place parttext into northparts. Set divisor to divisor divided by 10.\n\nThe northtext is join northparts with \"\". Show easttext. Show northtext.\n","expected":"-0.79810\n-0.17910\n","step_budget":2000000},{"id":479,"slug":"largest-palindrome-product","title":"Largest Palindrome Product","difficulty":"Hard","category":"Math","code":"Keep a shared best of 0.\nTo check with product (a whole number). The rest is product. The reversed is 0.\nRepeat while rest is more than 0.\nThe digit is rest modulo 10. Set reversed to reversed times 10 plus digit. Set rest to rest divided by 10. If rest is 0 and reversed is product and product is more than best, set best to product.\n\nThe low is 10. The high is 99.\nFor every first from low to high.\nFor every second from first to high.\nThe product is first times second. Check with product.\n\nThe answer is best modulo 1337. Show answer.\n","expected":"987\n","step_budget":2000000},{"id":480,"slug":"sliding-window-median","title":"Sliding Window Median","difficulty":"Hard","category":"Array","code":"The numbers is a list of 1, 3, -1, -3, 5, 3, 6, 7. The width is 3. The last is the last position of numbers. The limit is last minus width plus 1. The medians is an empty list of whole numbers.\nFor every start from 0 to limit.\nThe window is a list of item start of numbers, item (start plus 1) of numbers, and item (start plus 2) of numbers. Sort window. The middle is width divided by 2. Place item middle of window into medians.\n\nFor each value in medians, show value.\n","expected":"1\n-1\n-1\n3\n5\n6\n","step_budget":2000000},{"id":481,"slug":"magical-string","title":"Magical String","difficulty":"Medium","category":"String","code":"The count is 6. The sequence is a list of 1, 2, and 2. The size is 3. The spot is 2. The value is 1.\nRepeat while size is less than count.\nThe run is item spot of sequence. For every step from 1 to run, Place value into sequence, add 1 to size. If value is 1, set value to 2, otherwise set value to 1. Add 1 to spot.\n\nThe ones is 0.\nFor every place from 0 to count minus 1.\nIf item place of sequence is 1, add 1 to ones.\n\nShow ones.\n","expected":"3\n","step_budget":2000000},{"id":482,"slug":"license-key-formatting","title":"License Key Formatting","difficulty":"Easy","category":"String","code":"Keep a shared source as empty text. Keep a shared smalls as empty text. Keep a shared bigs as empty text. Keep a shared cleaned as an empty list of text. Keep a shared mapped as empty text.\nTo seek from spot (a whole number). If spot is more than 25, return. The piece is the slice of smalls from spot to spot plus 1. If piece matches mapped, set mapped to the slice of bigs from spot to spot plus 1, return. Seek from spot plus 1.\n\nTo convert from spot (a whole number). If spot is more than the last position of source, return. The piece is the slice of source from spot to spot plus 1. Set mapped to piece. If piece does not match \"-\", seek from 0. If piece does not match \"-\", Place mapped into cleaned. Convert from spot plus 1.\n\nPlace \"5F3Z-2e-9-w\" into source. Place \"abcdefghijklmnopqrstuvwxyz\" into smalls. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into bigs. Convert from 0. The width is 4. The size is one more than the last position of cleaned. The firstsize is size modulo width. The limit is width. If firstsize is more than 0, set limit to firstsize. The formatted is an empty list of text. The used is 0. The final is the last position of cleaned.\nFor every spot from 0 to final.\nIf used is limit and used is more than 0, Place \"-\" into formatted, set used to 0, set limit to width. Place item spot of cleaned into formatted. Add 1 to used.\n\nThe result is join formatted with \"\". Show result.\n","expected":"5F3Z-2E9W\n","step_budget":2000000},{"id":483,"slug":"smallest-good-base","title":"Smallest Good Base","difficulty":"Hard","category":"Math","code":"Keep a shared goal of 0. Keep a shared answer of 0. Set goal to 13.\nTo test with base (a whole number). The total is 1. The term is 1.\nRepeat while term is less than goal.\nSet term to term times base. If total plus term is at most goal, add term to total. If term is at least goal and total is goal and answer is 0, set answer to base.\n\nFor every base from 2 to goal minus 1.\nTest with base.\n\nThe result is format whole number answer as text. Show result.\n","expected":"3\n","step_budget":2000000},{"id":485,"slug":"max-consecutive-ones","title":"Max Consecutive Ones","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 1, 0, 1, 1, 1. The best is 0. The run is 0.\nFor each value in numbers.\nIf value is 1, add 1 to run, otherwise set run to 0. If run is more than best, set best to run.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":486,"slug":"predict-the-winner","title":"Predict the Winner","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 5, 2. The size is 3. The table is a list of 9 zeros.\nFor every span from 1 to size.\nFor every start from 0 to size minus span.\nThe finish is start plus span minus 1. If start is finish, set item (start times size plus start) of table to item start of numbers.\nIf start is not finish.\nThe leftindex is (start plus 1) times size plus finish. The rightindex is start times size plus finish minus 1. The left is item start of numbers minus item leftindex of table. The right is item finish of numbers minus item rightindex of table. If left is more than right, set item (start times size plus finish) of table to left, otherwise set item (start times size plus finish) of table to right.\n\nThe outcome is item (size minus 1) of table. If outcome is at least 0, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":488,"slug":"zuma-game","title":"Zuma Game","difficulty":"Hard","category":"String","code":"The board is \"G\". The hand is \"GGGGG\". The symbol is character 0 of board. The boardlast is the last position of board. The count is boardlast plus 1. The handlast is the last position of hand. The needed is 3 minus count. The matching is 0.\nFor every spot from 0 to handlast.\nIf character spot of hand is symbol, add 1 to matching. If matching is at least needed, stop.\n\nIf needed is less than 1, show 0, otherwise if matching is at least needed, show needed, otherwise show -1.\n","expected":"2\n","step_budget":2000000},{"id":491,"slug":"non-decreasing-subsequences","title":"Non-decreasing Subsequences","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 4, 6, 7, and 7. Keep a shared seen as an empty list of text. Keep a shared answers as an empty list of text. Keep a shared current as an empty list of whole numbers. Keep a shared keyparts as an empty list of text. Keep a shared key as empty text. Keep a shared count of 0. Keep a shared found of 0.\nTo look from spot (a whole number). If spot is more than the last position of seen, return. If item spot of seen matches key, set found to 1, return. Look from spot plus 1.\n\nTo emit. If count is less than 2, return. Set key to join keyparts with \",\". Set found to 0. Look from 0. If found is 0, Place key into seen, Place key into answers.\n\nTo grow from spot (a whole number) with last (a whole number). If spot is more than 3, emit, return. The amount is item spot of numbers. The piece is format whole number amount as text. If amount is at least last, Place amount into current, Place piece into keyparts, add 1 to count, Grow from spot plus 1 with amount, remove the last item from current, remove the last item from keyparts, subtract 1 from count. Grow from spot plus 1 with last.\n\nGrow from 0 with -100. For each line in answers, show line.\n","expected":"4,6,7,7\n4,6,7\n4,6\n4,7,7\n4,7\n6,7,7\n6,7\n7,7\n","step_budget":2000000},{"id":492,"slug":"construct-the-rectangle","title":"Construct the Rectangle","difficulty":"Easy","category":"Math","code":"The area is 4. The best is 1.\nFor every width from 1 to area.\nIf area modulo width is 0.\nThe height is area divided by width. If width is at most height and width is more than best, set best to width.\n\nThe other is area divided by best. Show best. Show other.\n","expected":"2\n2\n","step_budget":2000000},{"id":493,"slug":"reverse-pairs","title":"Reverse Pairs","difficulty":"Hard","category":"Array","code":"The numbers is a list of 1, 3, 2, 3, 1. The last is the last position of numbers. The count is 0.\nFor every first from 0 to last.\nFor every second from first plus 1 to last.\nIf item first of numbers is more than 2 times item second of numbers, add 1 to count.\n\nShow count.\n","expected":"2\n","step_budget":2000000},{"id":494,"slug":"target-sum","title":"Target Sum","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 1, 1, 1, and 1. Keep a shared ways of 0. Keep a shared aim of 3.\nTo score with total (a whole number). If total is aim, add 1 to ways.\n\nTo branch from spot (a whole number) with total (a whole number). If spot is at least 5, score with total, return. The amount is item spot of numbers. Branch from spot plus 1 with total plus amount. Branch from spot plus 1 with total minus amount.\n\nBranch from 0 with 0. Show ways.\n","expected":"5\n","step_budget":2000000},{"id":495,"slug":"teemo-attacking","title":"Teemo Attacking","difficulty":"Easy","category":"Array","code":"The moments is a list of 1, 4. The span is 2. The last is the last position of moments. The total is 0.\nFor every spot from 0 to last.\nThe here is item spot of moments. The total is total plus span.\nIf spot is less than last.\nThe next is item (spot plus 1) of moments. The covered is next minus here. If covered is less than span, subtract span from total, add covered to total.\n\nShow total.\n","expected":"4\n","step_budget":2000000},{"id":496,"slug":"next-greater-element-i","title":"Next Greater Element I","difficulty":"Easy","category":"Array","code":"Keep a shared second holding 1, 3, 4, and 2. Keep a shared atspot of 0. Keep a shared greater of 0.\nTo locate from spot (a whole number) with value (a whole number). If spot is more than the last position of second, return. If item spot of second is value, set atspot to spot, return. Locate from spot plus 1 with value.\n\nTo advance from spot (a whole number) with value (a whole number). If spot is more than the last position of second, return. If item spot of second is more than value, set greater to item spot of second, return. Advance from spot plus 1 with value.\n\nThe first is a list of 4, 1, 2.\nFor each value in first.\nSet atspot to -1. Set greater to -1. Locate from 0 with value. If atspot is at least 0, advance from atspot plus 1 with value. Show greater.\n","expected":"-1\n3\n-1\n","step_budget":2000000},{"id":497,"slug":"random-point-in-non-overlapping-rectangles","title":"Random Point in Non-overlapping Rectangles","difficulty":"Medium","category":"Array","code":"The rects is a list of -2, -2, -1, -1, 1, 0, 3, and 0. The count is 2. The total is 0.\nFor every spot from 0 to count minus 1.\nThe base is spot times 4. The xlow is item base of rects. The ylow is item (base plus 1) of rects. The xhigh is item (base plus 2) of rects. The yhigh is item (base plus 3) of rects. The width is xhigh minus xlow plus 1. The height is yhigh minus ylow plus 1. Add width times height to total.\n\nThe seed is 777. Set seed to seed times 1103515245 plus 12345. Set seed to seed modulo 2147483648. The pick is seed modulo total. The chosen is -1. The running is 0.\nFor every spot from 0 to count minus 1.\nThe base is spot times 4. The xlow is item base of rects. The ylow is item (base plus 1) of rects. The xhigh is item (base plus 2) of rects. The yhigh is item (base plus 3) of rects. The width is xhigh minus xlow plus 1. The height is yhigh minus ylow plus 1. The area is width times height. If chosen is -1 and pick is less than running plus area, set chosen to spot. Add area to running.\n\nThe base is chosen times 4. The xlow is item base of rects. The ylow is item (base plus 1) of rects. The xhigh is item (base plus 2) of rects. The yhigh is item (base plus 3) of rects. The width is xhigh minus xlow plus 1. The height is yhigh minus ylow plus 1. Set seed to seed times 1103515245 plus 12345. Set seed to seed modulo 2147483648. The east is xlow plus seed modulo width. Set seed to seed times 1103515245 plus 12345. Set seed to seed modulo 2147483648. The north is ylow plus seed modulo height. Show east. Show north.\n","expected":"2\n0\n","step_budget":2000000},{"id":498,"slug":"diagonal-traverse","title":"Diagonal Traverse","difficulty":"Medium","category":"Array","code":"Keep a shared matrix holding 1, 2, 3, 4, 5, 6, 7, 8, and 9. Keep a shared starts holding 0, 0, 2, 1, and 2. Keep a shared order as an empty list of whole numbers. Keep a shared rising of 0.\nTo seek from band (a whole number) with column (a whole number). If band is less than 0, return. If band is more than 2, return. If column is less than 0, return. If column is more than 2, return. Place item (band times 3 plus column) of matrix into order. If rising is 1, seek from band minus 1 with column plus 1. If rising is 0, seek from band plus 1 with column minus 1.\n\nFor every diagonal from 0 to 4.\nThe band is item diagonal of starts. The column is diagonal minus band. Set rising to 1 minus diagonal modulo 2. Seek from band with column.\n\nFor each value in order, show value.\n","expected":"1\n2\n4\n7\n5\n3\n6\n8\n9\n","step_budget":2000000},{"id":500,"slug":"keyboard-row","title":"Keyboard Row","difficulty":"Easy","category":"Array","code":"Keep a shared words holding \"Hello\", \"Alaska\", \"Dad\", and \"Peace\". Keep a shared bigs as empty text. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into bigs. Keep a shared smalls as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into smalls. Keep a shared rowone as empty text. Place \"qwertyuiop\" into rowone. Keep a shared rowtwo as empty text. Place \"asdfghjkl\" into rowtwo. Keep a shared rowthree as empty text. Place \"zxcvbnm\" into rowthree. Keep a shared current as empty text. Keep a shared lowered as empty text. Keep a shared chosen of 0. Keep a shared label of 0. Keep a shared bench as empty text. Keep a shared word as empty text. Keep a shared firstrow of 0. Keep a shared fail of 0. Keep a shared answers as an empty list of text.\nTo lower from spot (a whole number). If spot is more than 25, return. The bigpiece is the slice of bigs from spot to spot plus 1. The smallpiece is the slice of smalls from spot to spot plus 1. If bigpiece matches current, set lowered to smallpiece, return. If smallpiece matches current, set lowered to current, return. Lower from spot plus 1.\n\nTo rowcheck from spot (a whole number). If spot is more than the last position of bench, return. The piece is the slice of bench from spot to spot plus 1. If piece matches lowered, set chosen to label, return. Rowcheck from spot plus 1.\n\nFor each entry in words.\nSet word to entry. The lastchar is the last position of word. Set firstrow to 0. Set fail to 0.\nFor every place from 0 to lastchar.\nSet current to the slice of word from place to place plus 1. Set lowered to current. Lower from 0. Set chosen to 0. Set bench to rowone. Set label to 1. Rowcheck from 0. If chosen is 0, set bench to rowtwo. If chosen is 0, set label to 2. If chosen is 0, rowcheck from 0. If chosen is 0, set bench to rowthree. If chosen is 0, set label to 3. If chosen is 0, rowcheck from 0. If firstrow is 0, set firstrow to chosen. If chosen is not firstrow, set fail to 1. If place is lastchar and fail is 0, Place word into answers.\n\nFor each line in answers, show line.\n","expected":"Alaska\nDad\n","step_budget":9571322},{"id":501,"slug":"find-mode-in-binary-search-tree","title":"Find Mode in Binary Search Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, and 2. Keep a shared lefts holding -1, 2, and -1. Keep a shared rights holding 1, -1, and -1. Keep a shared order as an empty list of whole numbers. Keep a shared occurrences of 0.\n\nTo walk from node (a whole number). If node is less than 0, return. Walk from item node of lefts. Place item node of values into order. Walk from item node of rights.\n\nTo tally from spot (a whole number) with target (a whole number). If spot is more than the last position of order, return. If item spot of order is target, add 1 to occurrences. Tally from spot plus 1 with target.\n\nWalk from 0. Sort order. The best is 0.\nFor each value in order.\nSet occurrences to 0. Tally from 0 with value. If occurrences is more than best, set best to occurrences.\n\nThe answers is an empty list of whole numbers.\nFor each value in order.\nSet occurrences to 0. Tally from 0 with value. If occurrences is best and answers does not contain value, Place value into answers.\n\nFor each value in answers, show value.\n","expected":"2\n","step_budget":2000000},{"id":502,"slug":"ipo","title":"IPO","difficulty":"Hard","category":"Array","code":"Keep a shared profits holding 1, 2, and 3. Keep a shared capital holding 0, 1, and 1. Keep a shared used holding 0, 0, and 0. Keep a shared count of 3. Keep a shared wallet of 0. Keep a shared bestproject of 0. Keep a shared bestprofit of 0.\n\nTo choose. Set bestproject to -1. Set bestprofit to -1.\nFor every project from 0 to count minus 1.\nThe need is item project of capital. If item project of used is 0 and need is at most wallet and item project of profits is more than bestprofit, set bestproject to project, set bestprofit to item project of profits.\n\nFor every round from 1 to 2.\nChoose. If bestproject is at least 0, set item bestproject of used to 1, add bestprofit to wallet.\n\nShow wallet.\n","expected":"4\n","step_budget":2000000},{"id":503,"slug":"next-greater-element-ii","title":"Next Greater Element II","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 2, and 1. Keep a shared width of 0. Keep a shared answer of 0. Keep a shared last of 2. Set width to last plus 1.\n\nTo seek from step (a whole number) with spot (a whole number). If step is at least width, set answer to -1, return. The other is spot plus step. If other is more than last, set other to other minus width. If item other of numbers is more than item spot of numbers, set answer to item other of numbers, return. Seek from step plus 1 with spot.\n\nFor every spot from 0 to last.\nSet answer to -1. Seek from 1 with spot. Show answer.\n","expected":"2\n-1\n2\n","step_budget":2000000},{"id":504,"slug":"base-7","title":"Base 7","difficulty":"Easy","category":"String","code":"The amount is 100. The sign is 0. If amount is less than 0, set sign to 1, set amount to 0 minus amount. The digits is an empty list of whole numbers. If amount is 0, Place 0 into digits.\nRepeat while amount is more than 0.\nThe digit is amount modulo 7. Place digit into digits. Set amount to amount divided by 7.\n\nThe parts is an empty list of text. If sign is 1, Place \"-\" into parts. The last is the last position of digits.\nFor every spot from 0 to last.\nThe place is last minus spot. The piece is format whole number item place of digits as text. Place piece into parts.\n\nThe result is join parts with \"\". Show result.\n","expected":"202\n","step_budget":2000000},{"id":506,"slug":"relative-ranks","title":"Relative Ranks","difficulty":"Easy","category":"Array","code":"Keep a shared ranking as an empty list of whole numbers. Keep a shared last of 0. Keep a shared rank of 0.\n\nTo locate from spot (a whole number) with value (a whole number). If spot is more than last, return. If item spot of ranking is value, set rank to last minus spot plus 1, return. Locate from spot plus 1 with value.\n\nThe scores is a list of 5, 4, 3, 2, and 1.\nFor each value in scores.\nPlace value into ranking.\n\nSort ranking. Set last to the last position of ranking. The answers is an empty list of text.\nFor each value in scores.\nSet rank to 0. Locate from 0 with value. If rank is 1, Place \"Gold Medal\" into answers. If rank is 2, Place \"Silver Medal\" into answers. If rank is 3, Place \"Bronze Medal\" into answers. If rank is more than 3, The piece is format whole number rank as text, Place piece into answers.\n\nFor each line in answers, show line.\n","expected":"Gold Medal\nSilver Medal\nBronze Medal\n4\n5\n","step_budget":2000000},{"id":507,"slug":"perfect-number","title":"Perfect Number","difficulty":"Easy","category":"Math","code":"The target is 28. The total is 0.\nFor every divisor from 1 to target minus 1.\nIf target modulo divisor is 0, add divisor to total.\n\nIf total is target, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":508,"slug":"most-frequent-subtree-sum","title":"Most Frequent Subtree Sum","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 5, 2, and -3. Keep a shared lefts holding 1, -1, and -1. Keep a shared rights holding 2, -1, and -1. Keep a shared sums holding 0, 0, and 0. Keep a shared allsums as an empty list of whole numbers. Keep a shared occurrences of 0.\n\nTo score 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, score from left. If right is at least 0, score from right. The total is item node of values. If left is at least 0, set total to total plus item left of sums. If right is at least 0, set total to total plus item right of sums. Set item node of sums to total. Place total into allsums.\n\nTo tally from spot (a whole number) with target (a whole number). If spot is more than the last position of allsums, return. If item spot of allsums is target, add 1 to occurrences. Tally from spot plus 1 with target.\n\nScore from 0. The best is 0.\nFor each value in allsums.\nSet occurrences to 0. Tally from 0 with value. If occurrences is more than best, set best to occurrences.\n\nThe answers is an empty list of whole numbers.\nFor each value in allsums.\nSet occurrences to 0. Tally from 0 with value. If occurrences is best and answers does not contain value, Place value into answers.\n\nSort answers. For each value in answers, show value.\n","expected":"-3\n2\n4\n","step_budget":2000000},{"id":509,"slug":"fibonacci-number","title":"Fibonacci Number","difficulty":"Easy","category":"Math","code":"The count is 4. The first is 0. The second is 1.\nFor every step from 1 to count.\nThe following is first plus second. Set first to second. Set second to following.\n\nShow first.\n","expected":"3\n","step_budget":2000000},{"id":513,"slug":"find-bottom-left-tree-value","title":"Find Bottom Left Tree Value","difficulty":"Medium","category":"Depth-First Search","code":"The values is a list of 2, 1, and 3. The lefts is a list of 1, -1, and -1. The rights is a list of 2, -1, and -1. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The remaining is 1. The levelcount is 1. The nextcount is 0. The depth is 0. The bestdepth is 0. The leftmost is item 0 of values.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. If remaining is levelcount and depth is more than bestdepth, set bestdepth to depth, set leftmost to item node of values. If item node of lefts is at least 0, Place item node of lefts into queue, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. If remaining is 0, set remaining to nextcount, set levelcount to nextcount, set nextcount to 0, add 1 to depth.\n\nShow leftmost.\n","expected":"1\n","step_budget":2000000},{"id":514,"slug":"freedom-trail","title":"Freedom Trail","difficulty":"Hard","category":"String","code":"Keep a shared ring as empty text. Place \"godding\" into ring. Keep a shared key as empty text. Place \"gd\" into key. Keep a shared width of 7. Keep a shared big of 1000000. Keep a shared costs as an empty list of whole numbers. Keep a shared fresh as an empty list of whole numbers. Keep a shared wanted as empty text. Keep a shared active of 0. Keep a shared bestcost of 0.\n\nFor every slot from 0 to 6.\nPlace 1000000 into costs. Place 1000000 into fresh.\n\nTo probe from before (a whole number). If before is more than width minus 1, return. If item before of costs is less than big, The raw is active minus before, The gap is the absolute value of raw, The wrap is width minus gap, The route is the smaller of gap and wrap, The candidate is item before of costs plus route plus 1, If candidate is less than bestcost, set bestcost to candidate. Probe from before plus 1.\n\nTo prepare.\nFor every slot from 0 to width minus 1.\nSet item slot of fresh to big.\n\nTo measure from slot (a whole number). If slot is more than width minus 1, return. Set bestcost to big. If the slice of ring from slot to slot plus 1 matches wanted, set active to slot. If the slice of ring from slot to slot plus 1 matches wanted, probe from 0. If the slice of ring from slot to slot plus 1 matches wanted, record from slot. Measure from slot plus 1.\n\nTo record from slot (a whole number). Set item slot of fresh to bestcost.\n\nTo adopt.\nFor every slot from 0 to width minus 1.\nSet item slot of costs to item slot of fresh.\n\nSet wanted to the slice of key from 0 to 1.\nFor every slot from 0 to width minus 1.\nThe gap is the smaller of slot and width minus slot. If the slice of ring from slot to slot plus 1 matches wanted, set item slot of costs to gap plus 1.\n\nThe keylast is the last position of key.\nFor every step from 1 to keylast.\nSet wanted to the slice of key from step to step plus 1. Prepare. Measure from 0. Adopt.\n\nThe answer is big.\nFor every slot from 0 to width minus 1.\nIf item slot of costs is less than answer, set answer to item slot of costs.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":515,"slug":"find-largest-value-in-each-tree-row","title":"Find Largest Value in Each Tree Row","difficulty":"Medium","category":"Depth-First Search","code":"The values is a list of 1, 3, 2, 5, 3, -1, and 9. The lefts is a list of 1, 3, 5, -1, -1, -1, and -1. The rights is a list of 2, 4, 6, -1, -1, -1, and -1. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The remaining is 1. The levelcount is 1. The nextcount is 0. The best is 0. The answers is an empty list of whole numbers.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. If remaining is levelcount, set best to item node of values. If remaining is not levelcount and item node of values is more than best, set best to item node of values. If item node of lefts is at least 0, Place item node of lefts into queue, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. If remaining is 0, Place best into answers, set remaining to nextcount, set levelcount to nextcount, set nextcount to 0.\n\nFor each value in answers, show value.\n","expected":"1\n3\n9\n","step_budget":2000000},{"id":516,"slug":"longest-palindromic-subsequence","title":"Longest Palindromic Subsequence","difficulty":"Medium","category":"String","code":"The letters is \"bbbab\". The last is the last position of letters. The width is last plus 1. The table is a list of 25 zeros.\nFor every spot from 0 to last.\nSet item (spot times width plus spot) of table to 1.\n\nFor every span from 2 to width.\nFor every begin from 0 to width minus span.\nThe tail is begin plus span minus 1. The belowrow is begin plus 1. The beforecolumn is tail minus 1. The cell is begin times width plus tail. The insidecell is belowrow times width plus beforecolumn. The inside is item insidecell of table. The withinside is inside plus 2. The dropfirstcell is belowrow times width plus tail. The droplastcell is begin times width plus beforecolumn. The dropfirst is item dropfirstcell of table. The droplast is item droplastcell of table. The better is the larger of dropfirst and droplast. If the slice of letters from begin to begin plus 1 matches the slice of letters from tail to tail plus 1, set item cell of table to withinside, otherwise set item cell of table to better.\n\nThe answer is item (width minus 1) of table. Show answer.\n","expected":"4\n","step_budget":2000000},{"id":517,"slug":"super-washing-machines","title":"Super Washing Machines","difficulty":"Hard","category":"Array","code":"The machines is a list of 1, 0, and 5. The last is the last position of machines. The count is last plus 1. The total is 0. For each value in machines, add value to total.\n\nThe share is total divided by count. The remainder is total modulo count. The running is 0. The best is 0.\nFor each value in machines.\nThe extra is value minus share. Increase running by extra. The flow is the absolute value of running. If flow is more than best, set best to flow. If extra is more than best, set best to extra.\n\nIf remainder is not 0, set best to -1. Show best.\n","expected":"3\n","step_budget":2000000},{"id":518,"slug":"coin-change-ii","title":"Coin Change II","difficulty":"Medium","category":"Array","code":"The coins is a list of 1, 2, and 5. The amount is 5. The ways is a list of 6 zeros. Set item 0 of ways to 1.\nFor each coin in coins.\nFor every value from coin to amount.\nThe previous is item (value minus coin) of ways. Increase item value of ways by previous.\n\nShow item amount of ways.\n","expected":"4\n","step_budget":2000000},{"id":519,"slug":"random-flip-matrix","title":"Random Flip Matrix","difficulty":"Medium","category":"Math","code":"Keep a shared seed of 2026. Keep a shared flipped as an empty list of whole numbers. Keep a shared rows of 2. Keep a shared columns of 3. Keep a shared total of rows times columns. Keep a shared chosen of 0.\n\nFor every cell from 0 to total minus 1.\nPlace 0 into flipped.\n\nTo draw. Set seed to seed times 1103515245 plus 12345. Set seed to seed modulo 2147483648. Set chosen to seed modulo total. The position is chosen. If item position of flipped is 1, draw, return. Set item position of flipped to 1.\n\nFor every turn from 1 to 4.\nDraw. The position is chosen. The row is position divided by columns. The column is position modulo columns. Show row. Show column.\n\nFor every cell from 0 to total minus 1.\nSet item cell of flipped to 0.\n\nDraw. The position is chosen. The row is position divided by columns. The column is position modulo columns. Show row. Show column.\n","expected":"1\n0\n1\n1\n0\n2\n0\n0\n0\n1\n","step_budget":2000000},{"id":520,"slug":"detect-capital","title":"Detect Capital","difficulty":"Easy","category":"String","code":"Keep a shared alphabet as empty text. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into alphabet. Keep a shared piece as empty text. Keep a shared upper of 0.\n\nTo test from spot (a whole number). If spot is more than 25, return. If the slice of alphabet from spot to spot plus 1 matches piece, set upper to 1, return. Test from spot plus 1.\n\nThe word is \"FlaG\". The last is the last position of word. The size is last plus 1. The capitals is 0.\nFor every spot from 0 to last.\nSet piece to the slice of word from spot to spot plus 1. Set upper to 0. Test from 0. If upper is 1, add 1 to capitals.\n\nThe firstpiece is the slice of word from 0 to 1. Set piece to firstpiece. Set upper to 0. Test from 0. The firstupper is upper. The valid is 0. If capitals is size, set valid to 1. If capitals is 0, set valid to 1. If firstupper is 1 and capitals is 1, set valid to 1. If valid is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":521,"slug":"longest-uncommon-subsequence-i","title":"Longest Uncommon Subsequence I","difficulty":"Easy","category":"String","code":"The first is \"aba\". The second is \"cdc\". The firstlast is the last position of first. The secondlast is the last position of second. The firstsize is 0.\nFor every spot from 0 to firstlast.\nAdd 1 to firstsize.\n\nThe secondsize is 0.\nFor every spot from 0 to secondlast.\nAdd 1 to secondsize.\n\nIf first matches second, show -1. If first does not match second, The answer is the larger of firstsize and secondsize, show answer.\n","expected":"3\n","step_budget":2000000},{"id":522,"slug":"longest-uncommon-subsequence-ii","title":"Longest Uncommon Subsequence II","difficulty":"Medium","category":"Array","code":"Keep a shared words holding \"aba\", \"cdc\", and \"eae\". Keep a shared count of 3. Keep a shared source as empty text. Keep a shared target as empty text. Keep a shared current as empty text. Keep a shared found of 0. Keep a shared span of 0. Keep a shared best of 0.\n\nTo scan from through (a whole number) with aim (a whole number). If aim is more than the last position of source, set found to 1, return. If through is more than the last position of target, return. If the slice of target from through to through plus 1 matches the slice of source from aim to aim plus 1, scan from through plus 1 with aim plus 1, return. Scan from through plus 1 with aim.\n\nTo measure. Set span to 0.\nFor every spot from 0 to the last position of current.\nAdd 1 to span.\n\nTo evaluate with first (a whole number). Set current to item first of words. Measure. If span is more than best, set best to span.\n\nTo probe from first (a whole number) with second (a whole number). If second is at least count, evaluate with first, return. If second is first, probe from first with second plus 1, return. Set source to item first of words. Set target to item second of words. Set found to 0. Scan from 0 with 0. If found is 1, return. Probe from first with second plus 1.\n\nFor every first from 0 to count minus 1.\nProbe from first with 0.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":523,"slug":"continuous-subarray-sum","title":"Continuous Subarray Sum","difficulty":"Medium","category":"Array","code":"The numbers is a list of 23, 2, 4, 6, and 7. The divisor is 6. The last is the last position of numbers. The flags is a list of 6 zeros. The firsts is a list of 6 zeros. Set item 0 of flags to 1. Set item 0 of firsts to -1. The running is 0. The found is 0.\nFor every spot from 0 to last.\nIncrease running by item spot of numbers. Set running to running modulo divisor. The key is running. If item key of flags is 0, set item key of flags to 1, set item key of firsts to spot. The stretch is spot minus item key of firsts. If item key of flags is 1 and stretch is at least 2, set found to 1. If found is 1, stop.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":524,"slug":"longest-word-in-dictionary-through-deleting","title":"Longest Word in Dictionary through Deleting","difficulty":"Medium","category":"Array","code":"Keep a shared words holding \"ale\", \"apple\", \"monkey\", and \"plea\". Keep a shared source as empty text. Keep a shared target as empty text. The longsource is \"abpcplea\". The copy is a copy of longsource. Set target to copy. Keep a shared current as empty text. Keep a shared winner as empty text. Keep a shared found of 0. Keep a shared span of 0. Keep a shared best of 0.\n\nTo scan from through (a whole number) with aim (a whole number). If aim is more than the last position of source, set found to 1, return. If through is more than the last position of target, return. If the slice of target from through to through plus 1 matches the slice of source from aim to aim plus 1, scan from through plus 1 with aim plus 1, return. Scan from through plus 1 with aim.\n\nTo measure. Set span to 0.\nFor every spot from 0 to the last position of current.\nAdd 1 to span.\n\nFor each word in words.\nSet source to word. Set found to 0. Scan from 0 with 0. If found is 1, set current to word. If found is 1, measure. If found is 1 and span is more than best, set best to span, set winner to current. If found is 1 and span is best, If the length of winner is more than 0, If current comes before winner, set winner to current.\n\nShow winner.\n","expected":"apple\n","step_budget":2000000},{"id":525,"slug":"contiguous-array","title":"Contiguous Array","difficulty":"Medium","category":"Array","code":"The numbers is a list of 0 and 1. The last is the last position of numbers. The width is last plus 1. The flags is a list of 5 zeros. The firsts is a list of 5 zeros. Set item width of flags to 1. Set item width of firsts to -1. The running is 0. The best is 0.\nFor every spot from 0 to last.\nThe step is -1. If item spot of numbers is 1, set step to 1. Increase running by step. The key is running plus width. If item key of flags is 0, set item key of flags to 1, set item key of firsts to spot. The stretch is spot minus item key of firsts. If item key of flags is 1 and stretch is more than best, set best to stretch.\n\nShow best.\n","expected":"2\n","step_budget":2000000},{"id":526,"slug":"beautiful-arrangement","title":"Beautiful Arrangement","difficulty":"Medium","category":"Array","code":"Keep a shared size of 2. Keep a shared chosen as an empty list of whole numbers.\nFor every spot from 0 to size.\nPlace 0 into chosen.\n\nKeep a shared ways of 0.\n\nTo offer from spot (a whole number) with value (a whole number). If item value of chosen is not 0, return. The down is spot modulo value. The up is value modulo spot. If down is 0 or up is 0, set item value of chosen to 1, place from spot plus 1, set item value of chosen to 0.\n\nTo place from spot (a whole number). If spot is more than size, add 1 to ways, return.\nFor every value from 1 to size.\nOffer from spot with value.\n\nPlace from 1. Show ways.\n","expected":"2\n","step_budget":2000000},{"id":528,"slug":"random-pick-with-weight","title":"Random Pick with Weight","difficulty":"Medium","category":"Array","code":"The weights is a list of 1 and 3. Keep a shared prefix as an empty list of whole numbers. The running is 0.\nFor each weight in weights.\nAdd weight to running. Place running into prefix.\n\nThe seed is 2026. The picks is 5. Keep a shared chosen of 0. Keep a shared limit of 0. Keep a shared floorat of 0. Keep a shared ceiling of 0. Keep a shared probe of 0. Set limit to the last position of prefix.\n\nTo search with aim (a whole number). Set floorat to 0. Set ceiling to limit. Set chosen to 0.\nRepeat while floorat is at most ceiling.\nSet probe to (floorat plus ceiling) divided by 2. The here is probe. If item here of prefix is more than aim, set ceiling to probe minus 1, otherwise set floorat to probe plus 1. Set chosen to floorat. If floorat is more than ceiling, stop.\n\nFor every draw from 1 to picks.\nSet seed to seed times 1103515245 plus 12345. Set seed to seed modulo 2147483648. The target is seed modulo running. Search with target. Show chosen.\n","expected":"1\n0\n1\n1\n1\n","step_budget":2000000},{"id":529,"slug":"minesweeper","title":"Minesweeper","difficulty":"Medium","category":"Array","code":"Keep a shared board holding 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, and 0. Keep a shared labels holding \"E\", \"M\", \"B\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", and \"8\". Keep a shared height of 4. Keep a shared width of 5. Keep a shared nearby of 0. Keep a shared rowsteps holding -1, -1, -1, 0, 0, 1, 1, and 1. Keep a shared colsteps holding -1, 0, 1, -1, 1, -1, 0, and 1.\n\nTo count from row (a whole number) with column (a whole number). Set nearby to 0.\nFor every step from 0 to 7.\nThe side is row plus item step of rowsteps. The depth is column plus item step of colsteps. The here is side times width plus depth. If side is at least 0 and side is less than height and depth is at least 0 and depth is less than width, If item here of board is 1, add 1 to nearby.\n\nTo reveal from row (a whole number) with column (a whole number). If row is less than 0 or row is at least height or column is less than 0 or column is at least width, return. The cell is row times width plus column. If item cell of board is not 0, return. Count from row with column. If nearby is more than 0, The score is nearby, set item cell of board to score plus 2, return. Set item cell of board to 2. Reveal from row minus 1 with column minus 1. Reveal from row minus 1 with column. Reveal from row minus 1 with column plus 1. Reveal from row with column minus 1. Reveal from row with column plus 1. Reveal from row plus 1 with column minus 1. Reveal from row plus 1 with column. Reveal from row plus 1 with column plus 1.\n\nReveal from 3 with 0. The line is empty text.\nFor every cell from 0 to 19.\nThe mark is item cell of board. The label is item mark of labels. Place label into line. If cell modulo width is width minus 1, show line, set line to empty text.\n","expected":"B1E1B\nB1M1B\nB111B\nBBBBB\n","step_budget":2000000},{"id":530,"slug":"minimum-absolute-difference-in-bst","title":"Minimum Absolute Difference in BST","difficulty":"Easy","category":"Depth-First Search","code":"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 0. Keep a shared started of 0. Keep a shared closest of 1000000.\n\nTo walk from node (a whole number). If node is less than 0, return. Walk from item node of lefts. The here is item node of values. The gap is here minus previous. If started is 1 and gap is less than closest, set closest to gap. Set previous to here. Set started to 1. Walk from item node of rights.\n\nWalk from 0. Show closest.\n","expected":"1\n","step_budget":2000000},{"id":532,"slug":"k-diff-pairs-in-an-array","title":"K-diff Pairs in an Array","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 3, 1, 4, 1, and 5. Keep a shared gap of 2. Keep a shared last of 0. Keep a shared pairs of 0. Sort numbers. Set last to the last position of numbers.\n\nTo seek from start (a whole number). The target is item start of numbers plus gap.\nFor every later from start plus 1 to last.\nIf item later of numbers is target, add 1 to pairs, stop.\n\nFor every first from 0 to last.\nIf first is 0, seek from first. If first is more than 0, If item first of numbers is not item (first minus 1) of numbers, seek from first.\n\nShow pairs.\n","expected":"2\n","step_budget":2000000},{"id":537,"slug":"complex-number-multiplication","title":"Complex Number Multiplication","difficulty":"Medium","category":"String","code":"The first is \"1+1i\". The second is \"1+1i\". Keep a shared clean as empty text. Keep a shared amount of 0. The firstparts is split first by \"+\". The secondparts is split second by \"+\".\n\nTo parse. The size is the number of characters in clean. The begin is 0. The sign is 1. The head is the slice of clean from 0 to 1. If head matches \"-\", set begin to 1, set sign to -1. Set amount to 0.\nFor every spot from begin to size minus 1.\nThe digit is the digit value of character spot of clean. Set amount to amount times 10 plus sign times digit.\n\nSet clean to empty text. Place item 0 of firstparts into clean. Parse. The firstreal is amount. Set clean to empty text. Place item 1 of firstparts into clean. The firstedge is the last position of clean. Set clean to the slice of clean from 0 to firstedge. Parse. The firstimag is amount. Set clean to empty text. Place item 0 of secondparts into clean. Parse. The secondreal is amount. Set clean to empty text. Place item 1 of secondparts into clean. The secondedge is the last position of clean. Set clean to the slice of clean from 0 to secondedge. Parse. The secondimag is amount.\n\nThe realpart is firstreal times secondreal minus firstimag times secondimag. The imagpart is firstreal times secondimag plus firstimag times secondreal. The result is empty text. Place format whole number realpart as text into result. Place \"+\" into result. Place format whole number imagpart as text into result. Place \"i\" into result. Show result.\n","expected":"0+2i\n","step_budget":2000000},{"id":538,"slug":"convert-bst-to-greater-tree","title":"Convert BST to Greater Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 4, 1, 6, 0, 2, 5, 7, 3, and 8. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, 7, -1, 8, -1, and -1. Keep a shared running of 0.\n\nTo boost from node (a whole number). If node is less than 0, return. Boost from item node of rights. The here is item node of values. Add here to running. Set item node of values to running. Boost from item node of lefts.\n\nBoost from 0. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Show item node of values. The left is item node of lefts. The right is item node of rights. If left is at least 0, Place left into queue, add 1 to count. If right is at least 0, Place right into queue, add 1 to count.\n","expected":"30\n36\n21\n36\n35\n26\n15\n33\n8\n","step_budget":2000000},{"id":539,"slug":"minimum-time-difference","title":"Minimum Time Difference","difficulty":"Medium","category":"Array","code":"The moments is a list of \"23:59\" and \"00:00\". The minutes is an empty list of whole numbers.\nFor each moment in moments.\nThe hourpiece is the slice of moment from 0 to 2. The minutepiece is the slice of moment from 3 to 5. The firstdigit is the digit value of character 0 of hourpiece. The seconddigit is the digit value of character 1 of hourpiece. The hour is firstdigit times 10 plus seconddigit. The thirddigit is the digit value of character 0 of minutepiece. The fourthdigit is the digit value of character 1 of minutepiece. The minute is thirddigit times 10 plus fourthdigit. The total is hour times 60 plus minute. Place total into minutes.\n\nSort minutes. The last is the last position of minutes. The closest is 1000000.\nFor every spot from 1 to last.\nThe earlier is item (spot minus 1) of minutes. The later is item spot of minutes. The gap is later minus earlier. If gap is less than closest, set closest to gap.\n\nThe firsttime is item 0 of minutes. The finaltime is item last of minutes. The wrapped is firsttime plus 1440 minus finaltime. If wrapped is less than closest, set closest to wrapped. Show closest.\n","expected":"1\n","step_budget":2000000},{"id":540,"slug":"single-element-in-a-sorted-array","title":"Single Element in a Sorted Array","difficulty":"Medium","category":"Array","code":"The entries is a list of 1, 1, 2, 3, 3, 4, 4, 8, and 8. The low is 0. The high is the last position of entries.\nRepeat while low is less than high.\nThe middle is (low plus high) divided by 2. If middle modulo 2 is 1, subtract 1 from middle. The here is item middle of entries. The next is item (middle plus 1) of entries. If here is next, set low to middle plus 2, otherwise set high to middle.\n\nThe answer is item low of entries. Show answer.\n","expected":"2\n","step_budget":2000000},{"id":541,"slug":"reverse-string-ii","title":"Reverse String II","difficulty":"Easy","category":"String","code":"The source is \"abcdefg\". The span is 2. Keep a shared letters as an empty list of text. The last is the last position of source.\nFor every spot from 0 to last.\nThe piece is the slice of source from spot to spot plus 1. Place piece into letters.\n\nTo mirror from left (a whole number) with right (a whole number).\nRepeat while left is less than right.\nswap item left of letters and item right of letters. Add 1 to left. Subtract 1 from right.\n\nThe start is 0.\nRepeat while start is at most last.\nThe finish is start plus span minus 1. If finish is more than last, set finish to last. Mirror from start with finish. Increase start by span plus span.\n\nThe result is join letters with \"\". Show result.\n","expected":"bacdfeg\n","step_budget":2000000},{"id":542,"slug":"01-matrix","title":"01 Matrix","difficulty":"Medium","category":"Array","code":"The grid is a list of 0, 0, 0, 0, 1, 0, 1, 1, and 1. Keep a shared distance as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared count of 0.\nFor every cell from 0 to 8.\nIf item cell of grid is 0, Place 0 into distance, Place cell into queue, add 1 to count. If item cell of grid is 1, Place 1000000 into distance.\n\nTo relax with spot (a whole number) and here (a whole number). The offered is here plus 1. If item spot of distance is more than offered, set item spot of distance to offered, Place spot into queue, add 1 to count.\n\nThe head is 0.\nRepeat while head is less than count.\nThe cell is item head of queue. Add 1 to head. The row is cell divided by 3. The column is cell modulo 3. The here is item cell of distance. If row is more than 0, relax with cell minus 3 and here. If row is less than 2, relax with cell plus 3 and here. If column is more than 0, relax with cell minus 1 and here. If column is less than 2, relax with cell plus 1 and here.\n\nFor each value in distance, show value.\n","expected":"0\n0\n0\n0\n1\n0\n1\n2\n1\n","step_budget":2000000},{"id":543,"slug":"diameter-of-binary-tree","title":"Diameter of Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, 4, and 5. 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 heights as an empty list of whole numbers.\nFor every node from 0 to 4.\nPlace 0 into heights.\n\nKeep a shared longest of 0.\n\nTo deepen from node (a whole number). If node is less than 0, return. The leftnode is item node of lefts. The rightnode is item node of rights. The leftheight is 0. The rightheight is 0. If leftnode is at least 0, deepen from leftnode. If leftnode is at least 0, set leftheight to item leftnode of heights. If rightnode is at least 0, deepen from rightnode. If rightnode is at least 0, set rightheight to item rightnode of heights. The through is leftheight plus rightheight. If through is more than longest, set longest to through. The taller is leftheight. If rightheight is more than taller, set taller to rightheight. Set item node of heights to taller plus 1.\n\nDeepen from 0. Show longest.\n","expected":"3\n","step_budget":2000000},{"id":546,"slug":"remove-boxes","title":"Remove Boxes","difficulty":"Hard","category":"Array","code":"Keep a shared boxes holding 1, 3, 2, 2, 2, 3, 4, 3, and 1. The size is 9. Keep a shared span of size plus 1. Keep a shared blocksize of size times span. The capacity is (size plus 1) times blocksize. Keep a shared table as an empty list of whole numbers.\nFor every slot from 0 to capacity minus 1.\nPlace 0 into table.\n\nKeep a shared best of 0. Keep a shared extra of 0.\n\nTo improve with start (a whole number) and finish (a whole number).\nFor every middle from start plus 1 to finish.\nThe firstbox is item start of boxes. The otherbox is item middle of boxes. If firstbox is otherbox, The gap is start plus 1, The prior is middle minus 1, The emptyspot is gap times blocksize plus prior times span, The rightspot is middle times blocksize plus finish times span plus extra plus 1, The leftpart is item emptyspot of table, The rightpart is item rightspot of table, The candidate is leftpart plus rightpart, If candidate is more than best, set best to candidate.\n\nThe states is size times blocksize. The spot is 0.\nRepeat while spot is less than states.\nThe block is spot divided by blocksize. The start is size minus 1 minus block. The rest is spot modulo blocksize. The finish is rest divided by span. The carryindex is rest modulo span. The extra is span minus 1 minus carryindex. Set best to 0. The key is start times blocksize plus finish times span plus extra. Set item key of table to 0. If start is at most finish, The basekey is (start plus 1) times blocksize plus finish times span, The bonus is extra plus 1, The square is bonus times bonus, Set best to item basekey of table plus square, Improve with start and finish, Set item key of table to best. Add 1 to spot.\n\nThe answerkey is (size minus 1) times span. The answer is item answerkey of table. Show answer.\n","expected":"23\n","step_budget":2000000},{"id":547,"slug":"number-of-provinces","title":"Number of Provinces","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared links holding 1, 1, 0, 1, 1, 0, 0, 0, and 1. Keep a shared visited as an empty list of whole numbers.\nFor every city from 0 to 2.\nPlace 0 into visited.\n\nKeep a shared size of 3.\n\nTo walk from city (a whole number). If item city of visited is 1, return. Set item city of visited to 1.\nFor every next from 0 to 2.\nThe spot is city times size plus next. If item spot of links is 1, walk from next.\n\nThe provinces is 0.\nFor every city from 0 to 2.\nIf item city of visited is 0, add 1 to provinces. If item city of visited is 0, walk from city.\n\nShow provinces.\n","expected":"2\n","step_budget":2000000},{"id":551,"slug":"student-attendance-record-i","title":"Student Attendance Record I","difficulty":"Easy","category":"String","code":"The record is \"PPALLP\". The last is the last position of record. Start with absences of 0, a run of 0, and a longest of 0.\nFor every spot from 0 to last.\nThe mark is character spot of record. If mark is \"A\", add 1 to absences, set run to 0. If mark is \"L\", add 1 to run. If mark is not \"L\", set run to 0. If run is more than longest, set longest to run.\n\nIf absences is less than 2 and longest is less than 3, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":552,"slug":"student-attendance-record-ii","title":"Student Attendance Record II","difficulty":"Hard","category":"Dynamic Programming","code":"The length is 2. Keep a shared ways holding 0, 0, 0, 0, 0, and 0. Keep a shared fresh holding 0, 0, 0, 0, 0, and 0. Set item 0 of ways to 1.\nTo spread from state (a whole number). The count is item state of ways. The absences is state divided by 3. The lates is state modulo 3. The base is absences times 3. The basecount is item base of fresh. Set item base of fresh to basecount plus count. If lates is less than 2, set item (base plus lates plus 1) of fresh to item (base plus lates plus 1) of fresh plus count. If absences is 0, set item 3 of fresh to item 3 of fresh plus count.\n\nFor every step from 1 to length.\nFor every spot from 0 to 5, set item spot of fresh to 0. For every state from 0 to 5, spread from state. For every state from 0 to 5, set item state of ways to item state of fresh.\n\nThe total is 0.\nFor each count in ways.\nAdd count to total.\n\nShow total.\n","expected":"8\n","step_budget":2000000},{"id":553,"slug":"optimal-division","title":"Optimal Division","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1000, 100, 10, and 2. The last is the last position of numbers. The result is empty text. Place format whole number item 0 of numbers as text into result. If last is 1, Place \"/\" into result, Place format whole number item 1 of numbers as text into result. If last is more than 1, Place \"/(\" into result, Place format whole number item 1 of numbers as text into result. For every spot from 2 to last, Place \"/\" into result, Place format whole number item spot of numbers as text into result. If last is more than 1, Place \")\" into result.\n\nShow result.\n","expected":"1000/(100/10/2)\n","step_budget":2000000},{"id":554,"slug":"brick-wall","title":"Brick Wall","difficulty":"Medium","category":"Array","code":"The bricks is a list of 1, 2, 2, 1, 3, 1, 2, 1, 3, 2, 2, 4, 3, 1, 2, 1, 3, 1, and 1. The offsets is a list of 0, 4, 7, 10, 12, and 15. The sizes is a list of 4, 3, 3, 2, 3, and 4. The joints is a list of 6 zeros.\nFor every edge from 1 to 5.\nFor every row from 0 to 5.\nThe base is item row of offsets. The size is item row of sizes. The total is 0.\nFor every step from 0 to size minus 1.\nThe brick is item (base plus step) of bricks. Add brick to total. If total is edge, set item edge of joints to item edge of joints plus 1.\n\nThe best is 0.\nFor every spot from 1 to 5.\nIf item spot of joints is more than best, set best to item spot of joints.\n\nThe answer is 6 minus best. Show answer.\n","expected":"2\n","step_budget":2000000},{"id":556,"slug":"next-greater-element-iii","title":"Next Greater Element III","difficulty":"Medium","category":"String","code":"The value is 12. The digits is an empty list of whole numbers.\nRepeat while value is more than 0.\nThe digit is value modulo 10. Place digit into digits. Set value to value divided by 10.\n\nThe final is the last position of digits. The middle is (final plus 1) divided by 2.\nFor every left from 0 to middle minus 1.\nThe right is final minus left. swap item left of digits and item right of digits.\n\nThe pivot is -1.\nFor every spot from 0 to final minus 1.\nIf item spot of digits is less than item (spot plus 1) of digits, set pivot to spot.\n\nThe valid is 0. If pivot is at least 0, set valid to 1. If pivot is less than 0, set pivot to 0. The chosen is pivot plus 1.\nFor every spot from pivot plus 1 to final.\nIf item spot of digits is more than item pivot of digits, set chosen to spot.\n\nswap item pivot of digits and item chosen of digits. The middle is (pivot plus 1 plus final) divided by 2.\nFor every left from pivot plus 1 to middle.\nThe right is final minus (left minus pivot minus 1). If left is less than right, swap item left of digits and item right of digits.\n\nThe answer is 0.\nFor each digit in digits.\nSet answer to answer times 10 plus digit.\n\nIf valid is 1, show answer, otherwise show -1.\n","expected":"21\n","step_budget":2000000},{"id":557,"slug":"reverse-words-in-a-string-iii","title":"Reverse Words in a String III","difficulty":"Easy","category":"String","code":"The sentence is \"Let's take LeetCode contest\". The last is the last position of sentence. Keep a shared word as empty text. Keep a shared flipped as empty text. The result is empty text.\nTo mirror from spot (a whole number). If spot is less than 0, return. Place character spot of word into flipped. Mirror from spot minus 1.\n\nTo settle. Set flipped to empty text. Mirror from the last position of word.\n\nFor every spot from 0 to last.\nThe piece is character spot of sentence. If piece is \" \", settle, Place flipped into result, Place \" \" into result, set word to empty text. If piece is not \" \", Place piece into word. If spot is last, settle, Place flipped into result.\n\nShow result.\n","expected":"s'teL ekat edoCteeL tsetnoc\n","step_budget":2000000},{"id":558,"slug":"logical-or-of-two-binary-grids-represented-as-quad-trees","title":"Logical OR of Two Binary Grids Represented as Quad-Trees","difficulty":"Medium","category":"Tree","code":"The firstgrid is a list of 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, and 0. The secondgrid is a list of 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, and 1. Keep a shared merged as an empty list of whole numbers.\nFor every spot from 0 to 15.\nThe firstbit is item spot of firstgrid. The secondbit is item spot of secondgrid. If firstbit is 1 or secondbit is 1, Place 1 into merged. If firstbit is 0 and secondbit is 0, Place 0 into merged.\n\nKeep a shared isleaf as an empty list of whole numbers. Keep a shared leafvalue as an empty list of whole numbers. Keep a shared kids as an empty list of whole numbers. Keep a shared top of 0. Keep a shared leftedge of 0. Keep a shared width of 0. Keep a shared seed of 0. Keep a shared allsame of 0. Keep a shared made of 0.\nTo probe from down (a whole number) with across (a whole number). If down is at least top plus width, return. If across is at least leftedge plus width, probe from down plus 1 with leftedge, return. The spot is down times 4 plus across. If item spot of merged is not seed, set allsame to 0. Probe from down with across plus 1.\n\nTo mark from value (a whole number). The lastspot is the last position of isleaf. The spot is lastspot plus 1. Place 1 into isleaf. Place value into leafvalue. Place -1 into kids. Place -1 into kids. Place -1 into kids. Place -1 into kids. Set made to spot.\n\nTo square from down (a whole number) with across (a whole number). Set top to down. Set leftedge to across. Set width to 2. Set seed to item (down times 4 plus across) of merged. Set allsame to 1. Probe from down with across. If allsame is 1, mark from seed, return. The lastspot is the last position of isleaf. The node is lastspot plus 1. Place 0 into isleaf. Place 0 into leafvalue. Place -1 into kids. Place -1 into kids. Place -1 into kids. Place -1 into kids. Set seed to item (down times 4 plus across) of merged. Mark from seed. Set item (node times 4) of kids to made. Set seed to item (down times 4 plus across plus 1) of merged. Mark from seed. Set item (node times 4 plus 1) of kids to made. Set seed to item ((down plus 1) times 4 plus across) of merged. Mark from seed. Set item (node times 4 plus 2) of kids to made. Set seed to item ((down plus 1) times 4 plus across plus 1) of merged. Mark from seed. Set item (node times 4 plus 3) of kids to made. Set made to node.\n\nTo board from down (a whole number) with across (a whole number). Set top to down. Set leftedge to across. Set width to 4. Set seed to item (down times 4 plus across) of merged. Set allsame to 1. Probe from down with across. If allsame is 1, mark from seed, return. The lastspot is the last position of isleaf. The node is lastspot plus 1. Place 0 into isleaf. Place 0 into leafvalue. Place -1 into kids. Place -1 into kids. Place -1 into kids. Place -1 into kids. The middle is 2. Square from down with across. Set item (node times 4) of kids to made. Square from down with across plus middle. Set item (node times 4 plus 1) of kids to made. Square from down plus middle with across. Set item (node times 4 plus 2) of kids to made. Square from down plus middle with across plus middle. Set item (node times 4 plus 3) of kids to made. Set made to node.\n\nBoard from 0 with 0. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1. The line is empty text. Place \"[\" into line.\nRepeat while head is less than count.\nThe node is item head of queue. If head is more than 0, Place \",\" into line. Place \"[\" into line. Place format whole number item node of isleaf as text into line. Place \",\" into line. Place format whole number item node of leafvalue as text into line. Place \"]\" into line. If item node of isleaf is 0, Place item (node times 4) of kids into queue, add 1 to count. If item node of isleaf is 0, Place item (node times 4 plus 1) of kids into queue, add 1 to count. If item node of isleaf is 0, Place item (node times 4 plus 2) of kids into queue, add 1 to count. If item node of isleaf is 0, Place item (node times 4 plus 3) of kids into queue, add 1 to count. Add 1 to head.\n\nPlace \"]\" into line. Show line.\n","expected":"[[0,0],[1,1],[1,1],[1,0],[1,1]]\n","step_budget":2000000},{"id":559,"slug":"maximum-depth-of-n-ary-tree","title":"Maximum Depth of N-ary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 3, 2, 4, 5, and 6. Keep a shared parents holding -1, 0, 0, 0, 1, and 1. Keep a shared bestdepth of 0.\nTo descend from node (a whole number) with level (a whole number). If level is more than bestdepth, set bestdepth to level. For every candidate from 0 to 5, if item candidate of parents is node, descend from candidate with level plus 1.\n\nDescend from 0 with 1. Show bestdepth.\n","expected":"3\n","step_budget":2000000},{"id":560,"slug":"subarray-sum-equals-k","title":"Subarray Sum Equals K","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 1, and 1. The target is 2. The last is the last position of numbers. The total is 0.\nFor every start from 0 to last.\nThe sum is 0.\nFor every ending from start to last.\nThe value is item ending of numbers. Add value to sum. If sum is target, add 1 to total.\n\nShow total.\n","expected":"2\n","step_budget":2000000},{"id":561,"slug":"array-partition","title":"Array Partition","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 4, 3, and 2. Sort numbers. The last is the last position of numbers. The limit is last divided by 2. The total is 0.\nFor every pair from 0 to limit.\nThe spot is pair times 2. The value is item spot of numbers. Add value to total.\n\nShow total.\n","expected":"4\n","step_budget":2000000},{"id":563,"slug":"binary-tree-tilt","title":"Binary Tree Tilt","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, and 3. Keep a shared lefts holding 1, -1, and -1. Keep a shared rights holding 2, -1, and -1. Keep a shared sums holding 0, 0, and 0. Keep a shared totaltilt of 0. Keep a shared carry of 0.\nTo weigh from node (a whole number). If node is less than 0, set carry to 0, return. Weigh from item node of lefts. Set item node of sums to carry. Weigh from item node of rights. The gap is item node of sums minus carry. If gap is less than 0, set gap to 0 minus gap. Add gap to totaltilt. Increase item node of sums by carry plus item node of values. Set carry to item node of sums.\n\nWeigh from 0. Show totaltilt.\n","expected":"1\n","step_budget":2000000},{"id":564,"slug":"find-the-closest-palindrome","title":"Find the Closest Palindrome","difficulty":"Hard","category":"String","code":"Keep a shared source as empty text. Place \"123\" into source. Keep a shared sourcevalue of 0. Keep a shared length of 0. Keep a shared prefix of 0. Keep a shared made of 0. Keep a shared back of 0. Keep a shared best of 0. Keep a shared bestgap of 0. Keep a shared chosen of 0.\nTo peel from value (a whole number). If value is 0, return. The digit is value modulo 10. Set back to back times 10 plus digit. Peel from value divided by 10.\n\nTo reflect from seed (a whole number) with size (a whole number). The local is seed. If size modulo 2 is 1, set local to local divided by 10. Set back to 0. Peel from local. The scale is 1. The limit is size divided by 2. For every step from 1 to limit, set scale to scale times 10. Set made to seed times scale plus back.\n\nTo score from value (a whole number). If value is sourcevalue, return. The diff is value minus sourcevalue. If diff is less than 0, set diff to 0 minus diff. If chosen is 0, set best to value, set bestgap to diff, set chosen to 1, return. If diff is less than bestgap, set best to value, set bestgap to diff, return. If diff is bestgap and value is less than best, set best to value.\n\nThe last is the last position of source. Set length to last plus 1. The middle is (length plus 1) divided by 2.\nFor every spot from 0 to middle minus 1.\nThe digit is the digit value of character spot of source. Set prefix to prefix times 10 plus digit.\n\nFor every spot from 0 to last.\nThe digit is the digit value of character spot of source. Set sourcevalue to sourcevalue times 10 plus digit.\n\nReflect from prefix minus 1 with length. Score from made. Reflect from prefix with length. Score from made. Reflect from prefix plus 1 with length. Score from made. The lower is 1. For every step from 1 to length minus 1, set lower to lower times 10. Subtract 1 from lower. Score from lower. The upper is 1. For every step from 1 to length, set upper to upper times 10. Add 1 to upper. Score from upper.\n\nShow best.\n","expected":"121\n","step_budget":2000000},{"id":565,"slug":"array-nesting","title":"Array Nesting","difficulty":"Medium","category":"Array","code":"Keep a shared links holding 5, 4, 0, 3, 1, 6, and 2. The last is the last position of links. Keep a shared seen holding 0, 0, 0, 0, 0, 0, and 0. Keep a shared best of 0.\nTo walk from node (a whole number) with depth (a whole number). If item node of seen is 1, return. Set item node of seen to 1. If depth is more than best, set best to depth. Walk from item node of links with depth plus 1.\n\nFor every start from 0 to last.\nWalk from start with 1.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":566,"slug":"reshape-the-matrix","title":"Reshape the Matrix","difficulty":"Easy","category":"Array","code":"The matrix is a list of 1, 2, 3, and 4. The rows is 2. The columns is 2. The targetrows is 1. The targetcolumns is 4. The last is the last position of matrix. The total is last plus 1. If targetrows times targetcolumns is not total, set targetrows to rows, set targetcolumns to columns.\n\nThe line is empty text. Place \"[\" into line.\nFor every spot from 0 to last.\nIf spot is more than 0 and spot modulo targetcolumns is 0, Place \",\" into line. If spot modulo targetcolumns is 0, Place \"[\" into line. The value is item spot of matrix. Place format whole number value as text into line. If spot modulo targetcolumns is less than targetcolumns minus 1, Place \",\" into line. If spot modulo targetcolumns is targetcolumns minus 1, Place \"]\" into line.\n\nPlace \"]\" into line. Show line.\n","expected":"[[1,2,3,4]]\n","step_budget":2000000},{"id":567,"slug":"permutation-in-string","title":"Permutation in String","difficulty":"Medium","category":"String","code":"The pattern is \"ab\". The source is \"eidbaooo\". The target is sort characters of pattern. The width is the number of characters in pattern. The last is the last position of source. The final is last minus width plus 1. The found is 0.\nFor every start from 0 to final.\nThe finish is start plus width. The piece is the slice of source from start to finish. The ordered is sort characters of piece. If ordered matches target, set found to 1. If found is 1, stop.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":572,"slug":"subtree-of-another-tree","title":"Subtree of Another Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 3, 4, 5, 1, and 2. 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 targetvalues holding 4, 1, and 2. Keep a shared targetlefts holding 1, -1, and -1. Keep a shared targetrights holding 2, -1, and -1. Keep a shared alike of 0. Keep a shared found of 0.\nTo compare from one (a whole number) with two (a whole number). If alike is 0, return. If one is less than 0 and two is less than 0, return. If one is less than 0, set alike to 0, return. If two is less than 0, set alike to 0, return. If item one of values is not item two of targetvalues, set alike to 0, return. Compare from item one of lefts with item two of targetlefts. Compare from item one of rights with item two of targetrights.\n\nTo seek from node (a whole number). If node is less than 0, return. Set alike to 1. Compare from node with 0. If alike is 1, set found to 1, return. Seek from item node of lefts. Seek from item node of rights.\n\nSeek from 0. If found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":575,"slug":"distribute-candies","title":"Distribute Candies","difficulty":"Easy","category":"Array","code":"The candies is a list of 1, 1, 2, 2, 3, and 3. Sort candies. The last is the last position of candies. The kinds is 1.\nFor every spot from 1 to last.\nIf item spot of candies is not item (spot minus 1) of candies, add 1 to kinds.\n\nThe middle is (last plus 1) divided by 2. The answer is kinds. If middle is less than kinds, set answer to middle.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":576,"slug":"out-of-boundary-paths","title":"Out of Boundary Paths","difficulty":"Medium","category":"Dynamic Programming","code":"Keep a shared height of 0. Keep a shared width of 0. Keep a shared budget of 0. Keep a shared startrow of 0. Keep a shared startcolumn of 0. Keep a shared modulus of 0. Keep a shared cells of 0. Keep a shared counts as an empty list of whole numbers. Keep a shared next as an empty list of whole numbers. Keep a shared escapes of 0. Set height to 2. Set width to 2. Set budget to 2. Set startrow to 0. Set startcolumn to 0. Set modulus to 1000000007. Set cells to height times width.\nFor every cell from 0 to cells minus 1.\nPlace 0 into counts. Place 0 into next.\n\nThe start is startrow times width plus startcolumn. Set item start of counts to 1.\n\nTo wipe from spot (a whole number). If spot is at least cells, return. Set item spot of next to 0. Wipe from spot plus 1.\n\nTo spill from spot (a whole number). The row is spot divided by width. The column is spot modulo width. The weight is item spot of counts. If row is 0, set escapes to escapes plus weight. If row is 0, set escapes to escapes modulo modulus. If row is more than 0, set item (spot minus width) of next to item (spot minus width) of next plus weight. If row is height minus 1, set escapes to escapes plus weight. If row is height minus 1, set escapes to escapes modulo modulus. If row is less than height minus 1, set item (spot plus width) of next to item (spot plus width) of next plus weight. If column is 0, set escapes to escapes plus weight. If column is 0, set escapes to escapes modulo modulus. If column is more than 0, set item (spot minus 1) of next to item (spot minus 1) of next plus weight. If column is width minus 1, set escapes to escapes plus weight. If column is width minus 1, set escapes to escapes modulo modulus. If column is less than width minus 1, set item (spot plus 1) of next to item (spot plus 1) of next plus weight.\n\nTo sweep from spot (a whole number). If spot is at least cells, return. If item spot of counts is more than 0, spill from spot. Sweep from spot plus 1.\n\nTo save from spot (a whole number). If spot is at least cells, return. Set item spot of counts to item spot of next. Save from spot plus 1.\n\nTo travel from move (a whole number). If move is more than budget, return. Wipe from 0. Sweep from 0. Save from 0. Travel from move plus 1.\n\nTravel from 1. Show escapes.\n","expected":"6\n","step_budget":2000000},{"id":581,"slug":"shortest-unsorted-continuous-subarray","title":"Shortest Unsorted Continuous Subarray","difficulty":"Medium","category":"Array","code":"The numbers is a list of 2, 6, 4, 8, 10, 9, and 15. The ordered is an empty list of whole numbers.\nFor each value in numbers.\nPlace value into ordered.\n\nSort ordered. The first is -1. The farthest is -1.\nFor every spot from 0 to the last position of numbers.\nIf item spot of numbers is not item spot of ordered.\nIf first is less than 0, set first to spot. Set farthest to spot.\n\nIf first is less than 0, show 0, otherwise show farthest minus first plus 1.\n","expected":"5\n","step_budget":2000000},{"id":583,"slug":"delete-operation-for-two-strings","title":"Delete Operation for Two Strings","difficulty":"Medium","category":"String","code":"The first is \"sea\". The second is \"eat\". The firstlength is the number of characters in first. The secondlength is the number of characters in second. The width is secondlength plus 1. The height is firstlength plus 1. The cells is height times width. The chart is a list of 16 zeros.\nFor every row from 1 to firstlength.\nFor every column from 1 to secondlength.\nThe above is row minus 1. The before is column minus 1. The letter is the slice of first from above to above plus 1. The other is the slice of second from before to before plus 1. The spot is row times width plus column. The corner is above times width plus before. If letter matches other, set item spot of chart to item corner of chart plus 1.\nIf letter does not match other.\nThe up is above times width plus column. The left is row times width plus before. The best is item up of chart. If item left of chart is more than best, set best to item left of chart. Set item spot of chart to best.\n\nThe common is firstlength times width plus secondlength. The shared is item common of chart. The answer is firstlength plus secondlength minus 2 times shared. Show answer.\n","expected":"2\n","step_budget":2000000},{"id":587,"slug":"erect-the-fence","title":"Erect the Fence","difficulty":"Hard","category":"Array","code":"Keep a shared xvalues as an empty list of whole numbers. Keep a shared yvalues as an empty list of whole numbers. The posts is a list of 1, 1, 2, 2, 2, 0, 2, 4, 3, 3, 4, and 2.\nFor every spot from 0 to the last position of posts.\nIf spot modulo 2 is 0, Place item spot of posts into xvalues. If spot modulo 2 is 1, Place item spot of posts into yvalues.\n\nKeep a shared chosen of 0. Keep a shared lowerx as an empty list of whole numbers. Keep a shared lowery as an empty list of whole numbers. Keep a shared upperx as an empty list of whole numbers. Keep a shared uppery as an empty list of whole numbers. Keep a shared resultx as an empty list of whole numbers. Keep a shared resulty as an empty list of whole numbers. Keep a shared startx of 0. Keep a shared starty of 0. Keep a shared endx of 0. Keep a shared endy of 0. Keep a shared repeated of 0. Keep a shared checkx of 0. Keep a shared checky of 0.\n\nTo pick from cursor (a whole number) with best (a whole number). If cursor is more than the last position of xvalues, set chosen to best, return. The herex is item cursor of xvalues. The herey is item cursor of yvalues. The bestx is item best of xvalues. The besty is item best of yvalues. If herex is less than bestx, set best to cursor. If herex is bestx and herey is less than besty, set best to cursor. Pick from cursor plus 1 with best.\n\nTo trimleft. The size is the number of items in lowerx. If size is less than 3, return. The last is size minus 1. The middle is size minus 2. The first is size minus 3. The run is item middle of lowerx minus item first of lowerx. The rise is item last of lowery minus item first of lowery. The drop is item middle of lowery minus item first of lowery. The span is item last of lowerx minus item first of lowerx. The turn is run times rise minus drop times span.\nIf turn is at most 0.\nRemove item middle of lowerx. Remove item middle of lowery. Trimleft. Return.\n\nTo leftscan from cursor (a whole number). If cursor is more than the last position of xvalues, return. Place item cursor of xvalues into lowerx. Place item cursor of yvalues into lowery. Trimleft. Leftscan from cursor plus 1.\n\nTo trimright. The size is the number of items in upperx. If size is less than 3, return. The last is size minus 1. The middle is size minus 2. The first is size minus 3. The run is item middle of upperx minus item first of upperx. The rise is item last of uppery minus item first of uppery. The drop is item middle of uppery minus item first of uppery. The span is item last of upperx minus item first of upperx. The turn is run times rise minus drop times span.\nIf turn is at most 0.\nRemove item middle of upperx. Remove item middle of uppery. Trimright. Return.\n\nTo rightscan from cursor (a whole number). If cursor is less than 0, return. Place item cursor of xvalues into upperx. Place item cursor of yvalues into uppery. Trimright. Rightscan from cursor minus 1.\n\nTo verify from spot (a whole number). If spot is more than the last position of resultx, return. If item spot of resultx is checkx and item spot of resulty is checky, set repeated to 1, return. Verify from spot plus 1.\n\nTo collect from cursor (a whole number). If cursor is more than the last position of xvalues, return. The pointx is item cursor of xvalues. The pointy is item cursor of yvalues. The along is (pointx minus startx) times (endy minus starty) minus (pointy minus starty) times (endx minus startx). The lowx is startx. If endx is less than lowx, set lowx to endx. The highx is startx. If endx is more than highx, set highx to endx. The lowy is starty. If endy is less than lowy, set lowy to endy. The highy is starty. If endy is more than highy, set highy to endy. The outset is 0. If pointx is startx and pointy is starty, set outset to 1. If pointx is endx and pointy is endy, set outset to 1. Set repeated to 0. Set checkx to pointx. Set checky to pointy. Verify from 0. If along is 0 and outset is 0 and repeated is 0 and pointx is at least lowx and pointx is at most highx and pointy is at least lowy and pointy is at most highy, Place pointx into resultx, Place pointy into resulty. Collect from cursor plus 1.\n\nThe lastpost is the last position of xvalues.\nFor every outer from 0 to lastpost minus 1.\nSet chosen to outer. Pick from outer plus 1 with outer. The pickindex is chosen. The swapx is item outer of xvalues. The swapy is item outer of yvalues. Set item outer of xvalues to item pickindex of xvalues. Set item outer of yvalues to item pickindex of yvalues. Set item pickindex of xvalues to swapx. Set item pickindex of yvalues to swapy.\n\nLeftscan from 0. Rightscan from the last position of xvalues. The fencex is an empty list of whole numbers. The fencey is an empty list of whole numbers. The lowersize is the number of items in lowerx.\nFor every spot from 0 to lowersize minus 2.\nPlace item spot of lowerx into fencex. Place item spot of lowery into fencey.\n\nThe uppersize is the number of items in upperx.\nFor every spot from 0 to uppersize minus 2.\nPlace item spot of upperx into fencex. Place item spot of uppery into fencey.\n\nThe hullsize is the number of items in fencex.\nFor every edge from 0 to hullsize minus 1.\nThe nextedge is edge plus 1. If nextedge is hullsize, set nextedge to 0. Set startx to item edge of fencex. Set starty to item edge of fencey. Set endx to item nextedge of fencex. Set endy to item nextedge of fencey. Place startx into resultx. Place starty into resulty. Collect from 0.\n\nThe line is empty text. Place \"[\" into line.\nFor every spot from 0 to the last position of resultx.\nIf spot is more than 0, Place \",\" into line. Place \"[\" into line. The pointx is format whole number item spot of resultx as text. Place pointx into line. Place \",\" into line. The pointy is format whole number item spot of resulty as text. Place pointy into line. Place \"]\" into line.\n\nPlace \"]\" into line. Show line.\n","expected":"[[1,1],[2,0],[4,2],[3,3],[2,4]]\n","step_budget":2000000},{"id":589,"slug":"n-ary-tree-preorder-traversal","title":"N-ary Tree Preorder Traversal","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 3, 2, 4, 5, and 6. Keep a shared firstchild holding 1, 4, -1, -1, -1, and -1. Keep a shared nextsibling holding -1, 2, 3, -1, 5, and -1. Keep a shared order as an empty list of whole numbers.\n\nTo gather from node (a whole number). If node is less than 0, return. Place item node of values into order. The child is item node of firstchild.\nRepeat while child is at least 0.\nGather from child. Set child to item child of nextsibling.\n\nGather from 0. For each value in order, show value.\n","expected":"1\n3\n5\n6\n2\n4\n","step_budget":2000000},{"id":590,"slug":"n-ary-tree-postorder-traversal","title":"N-ary Tree Postorder Traversal","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 3, 2, 4, 5, and 6. Keep a shared firstchild holding 1, 4, -1, -1, -1, and -1. Keep a shared nextsibling holding -1, 2, 3, -1, 5, and -1. Keep a shared order as an empty list of whole numbers.\n\nTo gather from node (a whole number). If node is less than 0, return. Visit from item node of firstchild with node.\n\nTo visit from child (a whole number) with parent (a whole number). If child is less than 0, Place item parent of values into order, return. Gather from child. Visit from item child of nextsibling with parent.\n\nGather from 0. For each value in order, show value.\n","expected":"5\n6\n3\n2\n4\n1\n","step_budget":2000000},{"id":591,"slug":"tag-validator","title":"Tag Validator","difficulty":"Hard","category":"String","code":"Keep a shared code as empty text. Place \"<DIV>This is the first line <![CDATA[<div>]]></DIV>\" into code. Keep a shared spot of 0. Keep a shared ok of 0. Keep a shared name as empty text. Keep a shared found of 0. Keep a shared tags as an empty list of text. Set ok to 1.\n\nTo findmark from cursor (a whole number). Set found to 0 minus 1.\nRepeat while cursor plus 2 is at most the last position of code.\nThe piece is the slice of code from cursor to cursor plus 3. If piece matches \"]]>\", set found to cursor, stop. Add 1 to cursor.\n\nTo takecdata. If found is less than 0, set ok to 0, return. Set spot to found plus 3.\n\nTo scan from cursor (a whole number). If cursor is more than the last position of code, set spot to cursor, return. The here is cursor. If character here of code is \">\", set spot to cursor, return. Place character here of code into name. Scan from cursor plus 1.\n\nTo approve. The size is the number of characters in name. If size is less than 1, set ok to 0. If size is more than 9, set ok to 0.\nFor every index from 0 to size minus 1.\nThe letter is the slice of name from index to index plus 1. If letter comes before \"A\", set ok to 0. If \"Z\" comes before letter, set ok to 0.\n\nTo closetag. Add 2 to spot. Set name to empty text. Scan from spot. If spot is more than the last position of code, set ok to 0, return. Add 1 to spot. Approve. If ok is 0, return. The depth is the number of items in tags. If depth is 0, set ok to 0, return. The top is item (depth minus 1) of tags. If name does not match top, set ok to 0, return. Remove the last item from tags.\n\nTo opentag. The start is the slice of code from spot to spot plus 1. The angle is 0. If start matches \"<\", set angle to 1. If angle is 0, set ok to 0, return. Add 1 to spot. Set name to empty text. Scan from spot. If spot is more than the last position of code, set ok to 0, return. Approve. If ok is 0, return. Add 1 to spot. The copy is a copy of name. Place copy into tags. Content.\n\nTo content.\nRepeat while spot is at most the last position of code and ok is 1.\nThe here is spot. The finish is the last position of code. The marker is the slice of code from here to here plus 1. The next is here plus 1. If next is more than finish, set next to finish. The near is next plus 1. If near is more than finish plus 1, set near to finish plus 1. The follower is the slice of code from next to near. The wide is here plus 9. If wide is more than finish, set wide to finish plus 1. The head is the slice of code from here to wide. The cdata is 0. If head matches \"<![CDATA[\", set cdata to 1. If cdata is 1, findmark from here plus 9. If cdata is 1, takecdata. The isangle is 0. If marker matches \"<\", set isangle to 1. The isclose is 0. If follower matches \"/\", set isclose to 1. If cdata is 0 and isangle is 0, add 1 to spot. If cdata is 0 and isangle is 1 and isclose is 1, closetag. If cdata is 0 and isangle is 1 and isclose is 1, stop. If cdata is 0 and isangle is 1 and isclose is 0, opentag.\n\nThe size is the number of characters in code. If size is less than 1, set ok to 0. If size is more than 0 and ok is 1, opentag. If spot is not size, set ok to 0. The depth is the number of items in tags. If ok is 1 and depth is 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":592,"slug":"fraction-addition-and-subtraction","title":"Fraction Addition and Subtraction","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Place \"-1/2+1/2+1/3\" into source. Keep a shared spot of 0. Keep a shared sign of 0. Keep a shared top of 0. Keep a shared bottom of 0. Keep a shared number of 0. Keep a shared numerator of 0. Keep a shared denominator of 1.\n\nTo readnumber from cursor (a whole number). If cursor is more than the last position of source, set spot to cursor, return. If character cursor of source is not between \"0\" and \"9\", set spot to cursor, return. The digit is the digit value of character cursor of source. Set number to number times 10 plus digit. Add 1 to cursor. Readnumber from cursor.\n\nTo reduce from left (a whole number) with right (a whole number). If left is less than 0, set left to 0 minus left. If right is less than 0, set right to 0 minus right. If right is 0, set numerator to numerator divided by left, set denominator to denominator divided by left, return. The rest is left modulo right. Reduce from right with rest.\n\nRepeat while spot is at most the last position of source.\nThe here is spot. Set sign to 1. If character here of source is \"-\", set sign to 0 minus 1, add 1 to spot. If character here of source is \"+\", add 1 to spot. Set number to 0. Readnumber from spot. Set top to number. Add 1 to spot. Set number to 0. Readnumber from spot. Set bottom to number. Set numerator to numerator times bottom plus sign times top times denominator. Set denominator to denominator times bottom. Reduce from numerator with denominator.\n\nThe line is format whole number numerator as text. Place \"/\" into line. Place format whole number denominator as text into line. Show line.\n","expected":"1/3\n","step_budget":2000000},{"id":593,"slug":"valid-square","title":"Valid Square","difficulty":"Medium","category":"Math","code":"The points is a list of 0, 0, 1, 1, 1, 0, 0, 1. The gaps is an empty list of whole numbers.\nFor every first from 0 to 3.\nFor every second from first plus 1 to 3.\nThe firstspot is first times 2. The secondspot is second times 2. The gapx is item firstspot of points minus item secondspot of points. The gapy is item (firstspot plus 1) of points minus item (secondspot plus 1) of points. The distance is gapx times gapx plus gapy times gapy. Place distance into gaps.\n\nSort gaps. The side is item 0 of gaps. The diagonal is item 4 of gaps. If side is more than 0 and item 1 of gaps is side and item 2 of gaps is side and item 3 of gaps is side and item 5 of gaps is diagonal and diagonal is side times 2, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":594,"slug":"longest-harmonious-subsequence","title":"Longest Harmonious Subsequence","difficulty":"Easy","category":"Array","code":"The values is a list of 1, 3, 2, 2, 5, 2, 3, and 7. Sort values. The distinct is an empty list of whole numbers. The counts is an empty list of whole numbers.\nFor each value in values.\nThe size is the number of items in distinct. If size is 0, Place value into distinct, Place 1 into counts.\nIf size is more than 0.\nThe lastspot is size minus 1. If item lastspot of distinct is value, set item lastspot of counts to item lastspot of counts plus 1. If item lastspot of distinct is not value, Place value into distinct, Place 1 into counts.\n\nThe best is 0. The final is the last position of distinct.\nFor every spot from 0 to final minus 1.\nThe nextspot is spot plus 1.\nIf item nextspot of distinct is item spot of distinct plus 1.\nThe total is item spot of counts plus item nextspot of counts. If total is more than best, set best to total.\n\nShow best.\n","expected":"5\n","step_budget":2000000},{"id":598,"slug":"range-addition-ii","title":"Range Addition II","difficulty":"Easy","category":"Array","code":"The height is 3. The width is 3. The operations is a list of 2, 2, 3, 3. The pairs is the number of items in operations divided by 2. The rowlimit is height. The columnlimit is width.\nFor every pair from 0 to pairs minus 1.\nThe row is item (pair times 2) of operations. The column is item (pair times 2 plus 1) of operations. If row is less than rowlimit, set rowlimit to row. If column is less than columnlimit, set columnlimit to column.\n\nThe cells is rowlimit times columnlimit. Show cells.\n","expected":"4\n","step_budget":2000000},{"id":599,"slug":"minimum-index-sum-of-two-lists","title":"Minimum Index Sum of Two Lists","difficulty":"Easy","category":"Array","code":"The names is a list of \"Shogun\", \"Tapioca Express\", \"Burger King\", and \"KFC\". The favorites is a list of \"Piatti\", \"The Grill at Torrey Pines\", \"Hungry Hunter Steakhouse\", and \"Shogun\". The best is 1000000.\nFor every first from 0 to the last position of names.\nFor every second from 0 to the last position of favorites.\nIf item first of names matches item second of favorites.\nThe total is first plus second. If total is less than best, set best to total.\n\nThe answers is an empty list of text.\nFor every first from 0 to the last position of names.\nFor every second from 0 to the last position of favorites.\nIf item first of names matches item second of favorites.\nThe total is first plus second. If total is best, Place item first of names into answers.\n\nFor each answer in answers, show answer.\n","expected":"Shogun\n","step_budget":2000000},{"id":600,"slug":"non-negative-integers-without-consecutive-ones","title":"Non-negative Integers without Consecutive Ones","difficulty":"Hard","category":"Dynamic Programming","code":"The limit is 5. The ways is a list of 33 zeros. Set item 0 of ways to 1. Set item 1 of ways to 2.\nFor every spot from 2 to 32.\nThe prior is item (spot minus 1) of ways. The earlier is item (spot minus 2) of ways. Set item spot of ways to prior plus earlier.\n\nThe top is 0. The probe is limit.\nRepeat while probe is more than 0.\nSet probe to probe divided by 2. Add 1 to top.\n\nThe answer is 0. The before is 0. The blocked is 0.\nFor every step from 1 to top.\nThe position is top minus step. The raised is shift 1 left by position. The bit is bitwise and of limit and raised. If bit is more than 0, set answer to answer plus item position of ways. If bit is more than 0 and before is 1, set blocked to 1. If bit is more than 0, set before to 1. If bit is 0, set before to 0. If blocked is 1, stop.\n\nIf blocked is 0, add 1 to answer. Show answer.\n","expected":"5\n","step_budget":2000000},{"id":605,"slug":"can-place-flowers","title":"Can Place Flowers","difficulty":"Easy","category":"Array","code":"The flowerbed is a list of 1, 0, 0, 0, and 1. The wanted is 1. The last is the last position of flowerbed. The planted is 0.\nFor every spot from 0 to last.\nThe here is item spot of flowerbed. The leftfree is 1. If spot is more than 0 and item (spot minus 1) of flowerbed is 1, set leftfree to 0. The rightfree is 1. If spot is less than last and item (spot plus 1) of flowerbed is 1, set rightfree to 0. If here is 0 and leftfree is 1 and rightfree is 1, set item spot of flowerbed to 1, add 1 to planted.\n\nIf planted is at least wanted, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":606,"slug":"construct-string-from-binary-tree","title":"Construct String from Binary Tree","difficulty":"Medium","category":"String","code":"Keep a shared values holding 1, 2, 3, and 4. Keep a shared lefts holding 1, -1, -1, and -1. Keep a shared rights holding 2, 3, -1, and -1. Keep a shared built as empty text.\nTo cover from node (a whole number) with side (a whole number). Place \"(\" into built. Shape from node. Place \")\" into built.\n\nTo shape from node (a whole number). If node is less than 0, return. The piece is format whole number item node of values as text. Place piece into built. The left is item node of lefts. The right is item node of rights. If left is less than 0 and right is less than 0, return. If left is at least 0 and right is at least 0, cover from left with 0, cover from right with 1, return. If left is at least 0, cover from left with 0, return. Place \"()\" into built. Cover from right with 1.\n\nShape from 0. Show built.\n","expected":"1(2()(4))(3)\n","step_budget":2000000},{"id":609,"slug":"find-duplicate-file-in-system","title":"Find Duplicate File in System","difficulty":"Medium","category":"Array","code":"Keep a shared listings holding \"root/a 1.txt(abcd) 2.txt(efgh)\", \"root/c 3.txt(abcd)\", \"root/c/d 4.txt(efgh)\", and \"root 4.txt(efgh)\". Keep a shared parts as an empty list of text. Keep a shared folder as empty text. Keep a shared wanted as empty text. Keep a shared symbol as empty text. Keep a shared bracket of 0. Keep a shared contents as an empty list of text. Keep a shared groups as an empty list of text. Keep a shared atspot of 0. Keep a shared fullpath as empty text. Keep a shared content as empty text. Keep a shared line as empty text.\nTo seek from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The piece is the slice of wanted from spot to spot plus 1. If piece matches symbol, set bracket to spot, return. Seek from spot plus 1 with finish.\n\nTo look from place (a whole number). If place is more than the last position of contents, return. If item place of contents matches wanted, set atspot to place, return. Look from place plus 1.\n\nTo attach from spot (a whole number). Set line to item spot of groups. Place \",\" into line. Place fullpath into line. Set item spot of groups to line.\n\nTo collect from place (a whole number) with finish (a whole number). If place is more than finish, return. The part is item place of parts. The final is the last position of part. Set wanted to part. Set symbol to empty text. Place \"(\" into symbol. Set bracket to -1. Seek from 0 with final. The nameend is bracket. The name is the slice of part from 0 to nameend. Set content to the slice of part from bracket plus 1 to final. Set fullpath to empty text. Place folder into fullpath. Place \"/\" into fullpath. Place name into fullpath. Set wanted to content. Set atspot to -1. Look from 0. If atspot is less than 0, Place content into contents. If atspot is less than 0, Place fullpath into groups. If atspot is at least 0, Attach from atspot. Collect from place plus 1 with finish.\n\nFor each listing in listings.\nSet parts to split listing by \" \". Set folder to item 0 of parts. Collect from 1 with the last position of parts.\n\nThe spot is the last position of groups.\nRepeat while spot is at least 0.\nShow item spot of groups. Subtract 1 from spot.\n","expected":"root/a/2.txt,root/c/d/4.txt,root/4.txt\nroot/a/1.txt,root/c/3.txt\n","step_budget":2000000},{"id":611,"slug":"valid-triangle-number","title":"Valid Triangle Number","difficulty":"Medium","category":"Array","code":"Keep a shared sides holding 2, 2, 3, and 4. Sort sides. The final is the last position of sides. The count is 0.\nFor every first from 0 to final.\nFor every second from first plus 1 to final.\nFor every third from second plus 1 to final.\nThe left is item first of sides. The right is item second of sides. The longest is item third of sides. If left plus right is more than longest, add 1 to count.\n\nShow count.\n","expected":"3\n","step_budget":2000000},{"id":617,"slug":"merge-two-binary-trees","title":"Merge Two Binary Trees","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 3, 2, 5, 2, 1, 3, 0, 4, 0, and 7. Keep a shared lefts holding 1, 3, -1, -1, 5, -1, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, -1, -1, -1, 6, 8, 10, -1, -1, -1, and -1. Keep a shared pieces as an empty list of text.\nTo merge from first (a whole number) with second (a whole number). If first is less than 0 and second is less than 0, return. If first is less than 0, return. If second is less than 0, return. Increase item first of values by item second of values. The leftfirst is item first of lefts. The leftsecond is item second of lefts. If leftfirst is less than 0, set item first of lefts to leftsecond. If leftfirst is at least 0 and leftsecond is at least 0, merge from leftfirst with leftsecond. The rightfirst is item first of rights. The rightsecond is item second of rights. If rightfirst is less than 0, set item first of rights to rightsecond. If rightfirst is at least 0 and rightsecond is at least 0, merge from rightfirst with rightsecond.\n\nTo record from node (a whole number). The piece is format whole number item node of values as text. Place piece into pieces.\n\nMerge from 0 with 4. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe 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, record from node, Place item node of lefts into queue, Place item node of rights into queue, add 2 to count.\n\nRepeat while the last position of pieces is at least 0.\nThe tail is the last position of pieces. If item tail of pieces matches \"null\", remove the last item from pieces, otherwise stop.\n\nThe line is join pieces with \",\". Show line.\n","expected":"3,4,5,5,4,null,7\n","step_budget":2000000},{"id":621,"slug":"task-scheduler","title":"Task Scheduler","difficulty":"Medium","category":"Array","code":"The tasks is a list of \"A\", \"A\", \"A\", \"B\", \"B\", and \"B\". The gap is 2. Keep a shared run of 0. Keep a shared biggest of 0. Keep a shared leaders of 0. The joined is join tasks with \"\". The order is sort characters of joined. The last is the last position of order. The symbol is the slice of order from 0 to 1. Set run to 1.\nTo finish. If run is more than biggest, set biggest to run, set leaders to 1, return. If run is biggest, add 1 to leaders.\n\nFor every spot from 1 to last.\nThe piece is the slice of order from spot to spot plus 1. If piece matches symbol, add 1 to run, otherwise Finish, set symbol to piece, set run to 1.\n\nFinish. The spread is (biggest minus 1) times (gap plus 1) plus leaders. The final is the last position of tasks. The total is final plus 1. If spread is less than total, show total, otherwise show spread.\n","expected":"8\n","step_budget":2000000},{"id":623,"slug":"add-one-row-to-tree","title":"Add One Row to Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 4, 2, 6, 3, 1, and 5. Keep a shared lefts holding 1, 3, 5, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, -1, and -1. Keep a shared inserted of 1. Keep a shared depth of 2. Keep a shared made of 0. Keep a shared root of 0. Keep a shared pieces as an empty list of text.\nTo sprout. Place inserted into values. Place -1 into lefts. Place -1 into rights. Set made to the last position of values.\n\nTo fill from node (a whole number). The oldleft is item node of lefts. Sprout. Set item made of lefts to oldleft. Set item node of lefts to made. The oldright is item node of rights. Sprout. Set item made of rights to oldright. Set item node of rights to made.\n\nTo graft from node (a whole number) with level (a whole number). If node is less than 0, return. If level is depth minus 1, fill from node, return. If item node of lefts is at least 0, graft from item node of lefts with level plus 1. If item node of rights is at least 0, graft from item node of rights with level plus 1.\n\nTo record from node (a whole number). The piece is format whole number item node of values as text. Place piece into pieces.\n\nIf depth is 1, The oldroot is root, Sprout, Set item made of lefts to oldroot, Set root to made. If depth is more than 1, Graft from root with 1. The queue is an empty list of whole numbers. Place root into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe 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, record from node, Place item node of lefts into queue, Place item node of rights into queue, add 2 to count.\n\nRepeat while the last position of pieces is at least 0.\nThe tail is the last position of pieces. If item tail of pieces matches \"null\", remove the last item from pieces, otherwise stop.\n\nThe line is join pieces with \",\". Show line.\n","expected":"4,1,1,2,null,null,6,3,1,5\n","step_budget":2000000},{"id":624,"slug":"maximum-distance-in-arrays","title":"Maximum Distance in Arrays","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 2, 3, 4, 5, 1, 2, and 3. The starts is a list of 0, 3, and 5. The sizes is a list of 3, 2, and 3. Keep a shared smallest of 0. Keep a shared largest of 0.\nTo scan from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The amount is item spot of numbers. If amount is less than smallest, set smallest to amount. If amount is more than largest, set largest to amount. Scan from spot plus 1 with finish.\n\nSet smallest to item 0 of numbers. Set largest to item 0 of numbers. Scan from 0 with 2. The low is smallest. The high is largest. The best is 0.\nFor every band from 1 to 2.\nThe start is item band of starts. The finish is start plus item band of sizes minus 1. Set smallest to item start of numbers. Set largest to item start of numbers. Scan from start with finish. The down is largest minus low. The up is high minus smallest. If down is more than best, set best to down. If up is more than best, set best to up. If smallest is less than low, set low to smallest. If largest is more than high, set high to largest.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":628,"slug":"maximum-product-of-three-numbers","title":"Maximum Product of Three Numbers","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 2, and 3. Sort numbers. The last is the last position of numbers. The high is 1.\nFor every spot from last minus 2 to last.\nSet high to high times item spot of numbers.\n\nThe low is 1.\nFor every spot from 0 to 1.\nSet low to low times item spot of numbers.\n\nSet low to low times item last of numbers. If low is more than high, set high to low.\n\nShow high.\n","expected":"6\n","step_budget":2000000},{"id":629,"slug":"k-inverse-pairs-array","title":"K Inverse Pairs Array","difficulty":"Hard","category":"Dynamic Programming","code":"The size is 3. The pairs is 1. The rows is size plus 1. The columns is pairs plus 1. The total is rows times columns. The table is a list of total zeros. Set item 0 of table to 1.\nFor every length from 1 to size.\nFor every inversions from 0 to pairs.\nThe cell is length times columns plus inversions. The reach is inversions. If length minus 1 is less than reach, set reach to length minus 1. The base is (length minus 1) times columns.\nFor every used from 0 to reach.\nThe source is base plus inversions minus used. Set item cell of table to (item cell of table plus item source of table) modulo 1000000007.\n\nThe answer is item (size times columns plus pairs) of table. Show answer.\n","expected":"2\n","step_budget":2000000},{"id":630,"slug":"course-schedule-iii","title":"Course Schedule III","difficulty":"Hard","category":"Array","code":"Keep a shared durations holding 100, 200, 1000, and 2000. Keep a shared deadlines holding 200, 1300, 1250, and 3200. Keep a shared last of 3. Keep a shared picked of 0. Keep a shared best of 0. Keep a shared taken of 0. Keep a shared route as an empty list of whole numbers.\nTo seek from candidate (a whole number) with chosen (a whole number). If candidate is more than last, set picked to chosen, return. If item candidate of deadlines is less than item chosen of deadlines, set chosen to candidate. Seek from candidate plus 1 with chosen.\n\nTo place from spot (a whole number). The pick is spot. Seek from spot plus 1 with pick. If picked is not spot, swap item spot of deadlines and item picked of deadlines, swap item spot of durations and item picked of durations.\n\nTo record. If taken is more than best, set best to taken.\n\nTo explore from spot (a whole number) with total (a whole number). If spot is more than last, record, return. Explore from spot plus 1 with total. The finish is total plus item spot of durations.\nIf finish is at most item spot of deadlines.\nPlace spot into route. Add 1 to taken. Explore from spot plus 1 with finish. Subtract 1 from taken. Remove the last item from route.\n\nFor every spot from 0 to last minus 1.\nPlace from spot.\n\nExplore from 0 with 0. Show best.\n","expected":"3\n","step_budget":2000000},{"id":632,"slug":"smallest-range-covering-elements-from-k-lists","title":"Smallest Range Covering Elements from K Lists","difficulty":"Hard","category":"Array","code":"Keep a shared values holding 4, 10, 15, 24, 26, 0, 9, 12, 20, 5, 18, 22, and 30. Keep a shared begins holding 0, 5, and 9. Keep a shared sizes holding 5, 4, and 4. Keep a shared target of 0. Keep a shared smallest of 0. Keep a shared foundone of 0. Keep a shared complete of 0. Keep a shared highest of 0. Keep a shared bestlow of 0. Keep a shared besthigh of 0. Keep a shared bestwidth of 1000000000.\nTo find from group (a whole number) with spot (a whole number). The base is item group of begins. The size is item group of sizes. If spot is at least size, set foundone to 0, return. The value is item (base plus spot) of values. If value is at least target, set smallest to value, set foundone to 1, return. Find from group with spot plus 1.\n\nTo test from spot (a whole number). Set target to item spot of values. Set highest to -1000000000. Set complete to 1.\nFor every group from 0 to 2.\nSet foundone to 0. Find from group with 0. If foundone is 0, set complete to 0. If smallest is more than highest, set highest to smallest. If group is 2 and complete is 1 and highest minus target is less than bestwidth, set bestwidth to highest minus target, set bestlow to target, set besthigh to highest.\n\nFor every spot from 0 to 12.\nTest from spot.\n\nThe report is empty text. Place format whole number bestlow as text into report. Place \",\" into report. Place format whole number besthigh as text into report. Show report.\n","expected":"20,24\n","step_budget":2000000},{"id":633,"slug":"sum-of-square-numbers","title":"Sum of Square Numbers","difficulty":"Medium","category":"Math","code":"The target is 5. The right is 0.\nRepeat while right times right is at most target.\nAdd 1 to right.\n\nDecrease right by 1. The left is 0. The found is 0.\nRepeat while left is at most right.\nThe total is left times left plus right times right. If total is target, set found to 1, stop. If total is less than target, add 1 to left. If total is more than target, subtract 1 from right.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":636,"slug":"exclusive-time-of-functions","title":"Exclusive Time of Functions","difficulty":"Medium","category":"Array","code":"Keep a shared logs holding \"0:start:0\", \"1:start:2\", \"1:end:5\", and \"0:end:6\". Keep a shared stack as an empty list of whole numbers. Keep a shared elapsed holding 0 and 0. Keep a shared field as empty text. Keep a shared tally of 0. Keep a shared parsed of 0. Keep a shared prior of 0.\nTo read from spot (a whole number). If spot is more than the last position of field, set parsed to tally, return. The symbol is character spot of field.\nIf symbol is between \"0\" and \"9\".\nThe digit is the digit value of symbol. Set tally to tally times 10 plus digit. Read from spot plus 1.\n\nTo save from spot (a whole number) with amount (a whole number). Increase item spot of elapsed by amount.\n\nTo enter from worker (a whole number) with moment (a whole number). The top is the last position of stack. If top is at least 0, save from top with moment minus prior. Place worker into stack. Set prior to moment.\n\nTo exit from worker (a whole number) with moment (a whole number). Increase item worker of elapsed by moment minus prior plus 1. Remove the last item from stack. Set prior to moment plus 1.\n\nFor each entry in logs.\nThe fields is split entry by \":\". The event is item 1 of fields. Set field to item 0 of fields. Set tally to 0. Read from 0. The worker is parsed. Set field to item 2 of fields. Set tally to 0. Read from 0. The moment is parsed. If event matches \"start\", enter from worker with moment. If event matches \"end\", exit from worker with moment.\n\nThe firsttime is item 0 of elapsed. The secondtime is item 1 of elapsed. The report is empty text. Place format whole number firsttime as text into report. Place \",\" into report. Place format whole number secondtime as text into report. Show report.\n","expected":"3,4\n","step_budget":2000000},{"id":637,"slug":"average-of-levels-in-binary-tree","title":"Average of Levels in Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"The values is a list of 3, 9, 20, 15, and 7. The lefts is a list of 1, -1, 3, -1, and -1. The rights is a list of 2, -1, 4, -1, and -1. The queue is a list of 20 zeros. Keep a shared averages as an empty list of text.\nTo render with total (a whole number) with count (a whole number). The integer is total divided by count. The rest is total modulo count. The parts is an empty list of text. The headtext is format whole number integer as text. Place headtext into parts. Place \".\" into parts.\nFor every digit from 0 to 4.\nSet rest to rest times 10. The piece is rest divided by count. The pad is format whole number piece as text. Place pad into parts. Set rest to rest modulo count. If digit is 4, The built is join parts with \"\", Place built into averages.\n\nSet item 0 of queue to 0. The head is 0. The tail is 1. The remaining is 1. The nextcount is 0. The total is 0. The count is 0.\nRepeat while remaining is more than 0.\nThe node is item head of queue. Add 1 to head. Subtract 1 from remaining. Increase total by item node of values. Add 1 to count. The left is item node of lefts. If left is at least 0, set item tail of queue to left, add 1 to tail, add 1 to nextcount. The right is item node of rights. If right is at least 0, set item tail of queue to right, add 1 to tail, add 1 to nextcount. If remaining is 0, render with total with count, set total to 0, set count to 0, set remaining to nextcount, set nextcount to 0.\n\nThe line is join averages with \",\". Show line.\n","expected":"3.00000,14.50000,11.00000\n","step_budget":2000000},{"id":638,"slug":"shopping-offers","title":"Shopping Offers","difficulty":"Medium","category":"Array","code":"Keep a shared prices holding 2 and 5. Keep a shared wants holding 3 and 2. Keep a shared bundles holding 3, 0, 5, 1, 2, and 10. Keep a shared width of 3. Keep a shared deals of 2. Keep a shared best of 1000000. Keep a shared kinds of 2. Keep a shared costspot of width minus 1. Keep a shared fits of 0. Keep a shared regular of 0.\nTo measure from bundle (a whole number) with spot (a whole number). If spot is at least kinds, return. The amount is item (bundle times width plus spot) of bundles. If amount is more than item spot of wants, set fits to 0. Measure from bundle with spot plus 1.\n\nTo charge with spot (a whole number). If spot is at least kinds, return. The amount is item spot of wants times item spot of prices. Add amount to regular. Charge with spot plus 1.\n\nTo take from bundle (a whole number) with spot (a whole number). If spot is at least kinds, return. The amount is item (bundle times width plus spot) of bundles. Decrease item spot of wants by amount. Take from bundle with spot plus 1.\n\nTo carry from bundle (a whole number) with spot (a whole number). If spot is at least kinds, return. The amount is item (bundle times width plus spot) of bundles. Increase item spot of wants by amount. Carry from bundle with spot plus 1.\n\nTo settle with spent (a whole number). Set regular to 0. Charge with 0. The total is spent plus regular. If total is less than best, set best to total.\n\nTo explore from bundle (a whole number) with spent (a whole number). If spent is at least best, return. If bundle is at least deals, settle with spent, return. Explore from bundle plus 1 with spent. Set fits to 1. Measure from bundle with 0.\nIf fits is 1.\nTake from bundle with 0. Explore from bundle with spent plus item (bundle times width plus costspot) of bundles. Carry from bundle with 0.\n\nExplore from 0 with 0. Show best.\n","expected":"14\n","step_budget":2000000},{"id":639,"slug":"decode-ways-ii","title":"Decode Ways II","difficulty":"Hard","category":"String","code":"The source is \"1*\". The size is the number of characters in source. The table is a list of size plus 1 zeros. Set item 0 of table to 1.\nFor every position from 1 to size.\nThe current is character (position minus 1) of source. The previous is current. If position is more than 1, set previous to character (position minus 2) of source. If current is \"*\", set item position of table to (item position of table plus 9 times item (position minus 1) of table) modulo 1000000007. If current is between \"1\" and \"9\", set item position of table to (item position of table plus item (position minus 1) of table) modulo 1000000007. The pairways is 0. If position is more than 1 and previous is \"*\" and current is \"*\", set pairways to 15. If position is more than 1 and previous is \"*\" and current is between \"0\" and \"6\", set pairways to 2. If position is more than 1 and previous is \"*\" and current is between \"7\" and \"9\", set pairways to 1. If position is more than 1 and previous is \"1\" and current is \"*\", set pairways to 9. If position is more than 1 and previous is \"2\" and current is \"*\", set pairways to 6. If position is more than 1 and previous is \"1\" and current is between \"0\" and \"9\", set pairways to 1. If position is more than 1 and previous is \"2\" and current is between \"0\" and \"6\", set pairways to 1. If pairways is more than 0, set item position of table to (item position of table plus pairways times item (position minus 2) of table) modulo 1000000007.\n\nShow item size of table.\n","expected":"18\n","step_budget":2000000},{"id":640,"slug":"solve-the-equation","title":"Solve the Equation","difficulty":"Medium","category":"String","code":"Keep a shared side as empty text. Keep a shared coefficient of 0. Keep a shared constant of 0. Keep a shared collected of 0. Keep a shared after of 0. Keep a shared xnext of 0.\nTo finish from spot (a whole number) with total (a whole number). Set collected to total. Set after to spot.\n\nTo collect from spot (a whole number) with total (a whole number). If spot is more than the last position of side, finish from spot with total, return. The symbol is character spot of side. If symbol is not between \"0\" and \"9\", finish from spot with total, return. The digit is the digit value of symbol. Collect from spot plus 1 with total times 10 plus digit.\n\nTo peek from spot (a whole number). If spot is more than the last position of side, set xnext to 0, return. If character spot of side is \"x\", set xnext to 1, return. Set xnext to 0.\n\nTo score from mark (a whole number) with amount (a whole number). The folded is mark times amount. Increase coefficient by folded times xnext. The other is 1 minus xnext. Increase constant by folded times other.\n\nTo advance from spot (a whole number) with mark (a whole number). Set xnext to 1. Score from mark with 1. Inspect from spot plus 1 with mark.\n\nTo inspect from spot (a whole number) with mark (a whole number). If spot is more than the last position of side, return. The symbol is character spot of side. If symbol is \"+\", inspect from spot plus 1 with 1. If symbol is \"-\", inspect from spot plus 1 with -1. If symbol is \"x\", advance from spot with mark.\nIf symbol is between \"0\" and \"9\".\nSet collected to 0. Set xnext to 0. Collect from spot with 0. Peek from after. Score from mark with collected. Inspect from after plus xnext with mark.\n\nThe equation is \"x+5-3+x=6+x-2\". The sides is split equation by \"=\". Set side to item 0 of sides. Set coefficient to 0. Set constant to 0. Inspect from 0 with 1. The leftcoefficient is coefficient. The leftconstant is constant. Set side to item 1 of sides. Set coefficient to 0. Set constant to 0. Inspect from 0 with 1. The slope is leftcoefficient minus coefficient. The offset is constant minus leftconstant. If slope is 0 and offset is 0, show \"Infinite solutions\". If slope is 0 and offset is not 0, show \"No solution\".\nIf slope is not 0.\nThe value is offset divided by slope. The answer is empty text. Place \"x=\" into answer. The piece is format whole number value as text. Place piece into answer. Show answer.\n","expected":"x=2\n","step_budget":2000000},{"id":643,"slug":"maximum-average-subarray-i","title":"Maximum Average Subarray I","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 12, -5, -6, 50, and 3. The width is 4. The last is the last position of numbers. The window is 0.\nFor every spot from 0 to width minus 1.\nIncrease window by item spot of numbers.\n\nThe best is window.\nFor every start from 1 to last minus width plus 1.\nDecrease window by item (start minus 1) of numbers. Increase window by item (start plus width minus 1) of numbers. If window is more than best, set best to window.\n\nThe integer is best divided by width. The rest is best modulo width. The parts is an empty list of text. The headtext is format whole number integer as text. Place headtext into parts. Place \".\" into parts.\nFor every digit from 0 to 4.\nSet rest to rest times 10. The piece is rest divided by width. The pad is format whole number piece as text. Place pad into parts. Set rest to rest modulo width.\n\nThe line is join parts with \"\". Show line.\n","expected":"12.75000\n","step_budget":2000000},{"id":645,"slug":"set-mismatch","title":"Set Mismatch","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 2, 2, and 4. The count is the number of items in numbers. The tally is a list of count plus 1 zeros.\nFor each value in numbers.\nIncrease item value of tally by 1.\n\nThe repeated is 0. The absent is 0.\nFor every candidate from 1 to count.\nIf item candidate of tally is 2, set repeated to candidate. If item candidate of tally is 0, set absent to candidate.\n\nThe report is empty text. Place format whole number repeated as text into report. Place \",\" into report. Place format whole number absent as text into report. Show report.\n","expected":"2,3\n","step_budget":2000000},{"id":646,"slug":"maximum-length-of-pair-chain","title":"Maximum Length of Pair Chain","difficulty":"Medium","category":"Array","code":"Keep a shared begins holding 1, 2, and 3. Keep a shared finishes holding 2, 3, and 4. Keep a shared last of 2. Keep a shared picked of 0.\nTo seek from candidate (a whole number) with chosen (a whole number). If candidate is more than last, set picked to chosen, return. If item candidate of finishes is less than item chosen of finishes, set chosen to candidate. Seek from candidate plus 1 with chosen.\n\nTo place from spot (a whole number). The pick is spot. Seek from spot plus 1 with pick. If picked is not spot, swap item spot of finishes and item picked of finishes, swap item spot of begins and item picked of begins.\n\nFor every spot from 0 to last minus 1.\nPlace from spot.\n\nThe count is 0. The lastend is -1000000000.\nFor every spot from 0 to last.\nIf item spot of begins is more than lastend, add 1 to count, set lastend to item spot of finishes.\n\nShow count.\n","expected":"2\n","step_budget":2000000},{"id":647,"slug":"palindromic-substrings","title":"Palindromic Substrings","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Place \"abc\" into source. Keep a shared total of 0.\nTo spread from left (a whole number) with right (a whole number). If left is less than 0, return. If right is more than the last position of source, return. If character left of source is not character right of source, return. Add 1 to total. Spread from left minus 1 with right plus 1.\n\nFor every center from 0 to the last position of source.\nSpread from center with center. Spread from center with center plus 1.\n\nShow total.\n","expected":"3\n","step_budget":2000000},{"id":648,"slug":"replace-words","title":"Replace Words","difficulty":"Medium","category":"Array","code":"Keep a shared roots holding \"cat\", \"bat\", and \"rat\". Keep a shared word as empty text. Keep a shared chosen as empty text. Keep a shared bestlen of 0. Keep a shared root as empty text. Keep a shared rootlast of 0.\nTo settle with limit (a whole number). The extent is rootlast plus 1. If extent is less than limit, set chosen to root, set bestlen to extent.\n\nTo examine. The wordlast is the last position of word. If rootlast is more than wordlast, return. The prefix is the slice of word from 0 to rootlast plus 1. If prefix matches root, settle with bestlen.\n\nTo scan from spot (a whole number). If spot is more than the last position of roots, return. Set root to item spot of roots. Set rootlast to the last position of root. Examine. Scan from spot plus 1.\n\nThe words is a list of \"the\", \"cattle\", \"was\", \"rattled\", \"by\", \"the\", and \"battery\". The answers is an empty list of text.\nFor each entry in words.\nSet word to entry. Set chosen to entry. Set bestlen to 1000. Scan from 0. The kept is a copy of chosen. Place kept into answers.\n\nThe line is join answers with \" \". Show line.\n","expected":"the cat was rat by the bat\n","step_budget":2000000},{"id":649,"slug":"dota2-senate","title":"Dota2 Senate","difficulty":"Medium","category":"String","code":"Keep a shared redqueue as an empty list of whole numbers. Keep a shared bluequeue as an empty list of whole numbers. Keep a shared redstart of 0. Keep a shared redend of 0. Keep a shared bluestart of 0. Keep a shared blueend of 0. Keep a shared size of 0. Keep a shared redpick of 0. Keep a shared bluepick of 0. The reds is a list of 20 zeros. The blues is a list of 20 zeros. Set redqueue to reds. Set bluequeue to blues.\nTo brighten from pick (a whole number). The endspot is redend. Set item endspot of redqueue to pick plus size. Add 1 to redend. Add 1 to redstart. Add 1 to bluestart.\n\nTo darken from pick (a whole number). The endspot is blueend. Set item endspot of bluequeue to pick plus size. Add 1 to blueend. Add 1 to redstart. Add 1 to bluestart.\n\nThe source is \"RD\". Set size to the number of characters in source.\nFor every seat from 0 to size minus 1.\nThe symbol is character seat of source. The redslot is redend. The blueslot is blueend. If symbol is \"R\", set item redslot of redqueue to seat, add 1 to redend. If symbol is \"D\", set item blueslot of bluequeue to seat, add 1 to blueend.\n\nRepeat while redstart is less than redend and bluestart is less than blueend.\nThe redslot is redstart. The blueslot is bluestart. Set redpick to item redslot of redqueue. Set bluepick to item blueslot of bluequeue. If redpick is less than bluepick, brighten from redpick, otherwise darken from bluepick.\n\nIf redstart is less than redend, show \"Radiant\". If bluestart is less than blueend, show \"Dire\".\n","expected":"Radiant\n","step_budget":2000000},{"id":650,"slug":"2-keys-keyboard","title":"2 Keys Keyboard","difficulty":"Medium","category":"Math","code":"The cells is 3. The moves is 0. The divisor is 2.\nRepeat while cells is more than 1.\nIf cells modulo divisor is 0, add divisor to moves, set cells to cells divided by divisor. If cells modulo divisor is not 0, add 1 to divisor.\n\nShow moves.\n","expected":"3\n","step_budget":2000000},{"id":652,"slug":"find-duplicate-subtrees","title":"Find Duplicate Subtrees","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, 4, 2, 4, and 4. Keep a shared lefts holding 1, 3, 4, -1, 6, -1, and -1. Keep a shared rights holding 2, -1, 5, -1, -1, -1, and -1. Keep a shared serial as empty text. Keep a shared keys as an empty list of text. Keep a shared found as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared pieces as an empty list of text. Keep a shared count of 0. Keep a shared tally of 0. Keep a shared earlier of 0. Keep a shared drawn as empty text.\nTo encode from node (a whole number). If node is less than 0, Place \"#\" into serial, return. Place format whole number item node of values as text into serial. Place \"(\" into serial. Encode from item node of lefts. Place \",\" into serial. Encode from item node of rights. Place \")\" into serial.\n\nTo tally from node (a whole number). The amount is 0.\nFor every other from 0 to the last position of keys.\nIf item other of keys matches item node of keys, add 1 to amount. Set tally to amount.\n\nTo inspect from node (a whole number) with limit (a whole number). The seenbefore is 0.\nFor every prior from 0 to limit minus 1.\nIf item prior of keys matches item node of keys, set seenbefore to 1. Set earlier to seenbefore.\n\nTo emit from node (a whole number). If node is less than 0, Place \"null\" into pieces, return. The piece is format whole number item node of values as text. Place piece into pieces. Place item node of lefts into queue. Place item node of rights into queue. Add 2 to count.\n\nTo drain.\nRepeat while the number of items in queue is more than 0.\nRemove the last item from queue.\n\nTo reset.\nRepeat while the number of items in pieces is more than 0.\nRemove the last item from pieces.\n\nTo trim trailing.\nRepeat while the last position of pieces is at least 0.\nThe tail is the last position of pieces. The tailpiece is item tail of pieces. The isnull is 0. If tailpiece matches \"null\", set isnull to 1. If isnull is 1, remove the last item from pieces. If isnull is 0, stop.\n\nTo render from root (a whole number). Drain. Reset. Place root into queue. Set count to 1. The head is 0.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Emit from node.\n\nFor every node from 0 to the last position of values.\nSet serial to empty text. Encode from node. The copy is a copy of serial. Place copy into keys.\n\nFor every node from 0 to the last position of keys.\nTally from node. Inspect from node with node. If tally is more than 1 and earlier is 0, Place node into found.\n\nThe output is empty text. Place \"[\" into output.\nFor each root in found.\nIf the length of output is more than 1, Place \",\" into output. Render from root. Trim trailing. Set drawn to join pieces with \",\". Place \"[\" into output. Place drawn into output. Place \"]\" into output.\n\nPlace \"]\" into output. Show output.\n","expected":"[[2,4],[4]]\n","step_budget":2000000},{"id":653,"slug":"two-sum-iv-input-is-a-bst","title":"Two Sum IV - Input is a BST","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 5, 3, 6, 2, 4, and 7. Keep a shared lefts holding 1, 3, 5, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, -1, and -1. Keep a shared order as an empty list of whole numbers.\nTo gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Place item node of values into order. Gather from item node of rights.\n\nGather from 0. The wanted is 9. The left is 0. The right is the last position of order. The found is 0.\nRepeat while left is less than right.\nThe pair is item left of order plus item right of order. If pair is wanted, set found to 1, stop. If pair is less than wanted, add 1 to left. If pair is more than wanted, subtract 1 from right.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":654,"slug":"maximum-binary-tree","title":"Maximum Binary Tree","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 3, 2, 1, 6, 0, and 5. Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared pieces as an empty list of text. Keep a shared count of 0. Keep a shared made of 0. Keep a shared parent of 0. Keep a shared side of 0. Keep a shared chosen of 0.\nTo locate from low (a whole number) with high (a whole number). The pick is low.\nFor every look from low to high.\nThe value is item look of numbers. The current is item pick of numbers. If value is more than current, set pick to look. Set chosen to pick.\n\nTo build from low (a whole number) with high (a whole number). If low is more than high, return. Locate from low with high. The place is chosen. The slot is made. Add 1 to made. Place item place of numbers into values. Place -1 into lefts. Place -1 into rights. The holder is parent. If holder is at least 0 and side is 0, set item holder of lefts to slot. If holder is at least 0 and side is 1, set item holder of rights to slot. Set parent to slot. Set side to 0. Build from low with place minus 1. Set parent to slot. Set side to 1. Build from place plus 1 with high.\n\nTo emit from node (a whole number). If node is less than 0, Place \"null\" into pieces, return. The piece is format whole number item node of values as text. Place piece into pieces. Place item node of lefts into queue. Place item node of rights into queue. Add 2 to count.\n\nSet parent to -1. Build from 0 with 5. Place 0 into queue. Set count to 1. The head is 0.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Emit from node.\n\nRepeat while the last position of pieces is at least 0.\nThe tail is the last position of pieces. The tailpiece is item tail of pieces. The isnull is 0. If tailpiece matches \"null\", set isnull to 1. If isnull is 1, remove the last item from pieces. If isnull is 0, stop.\n\nThe line is join pieces with \",\". Show line.\n","expected":"6,3,5,null,2,0,null,null,1\n","step_budget":2000000},{"id":655,"slug":"print-binary-tree","title":"Print Binary Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, and 4. Keep a shared lefts holding 1, -1, -1, and -1. Keep a shared rights holding 2, 3, -1, and -1. Keep a shared depths as an empty list of whole numbers. Keep a shared places as an empty list of whole numbers. Keep a shared height of 0. Keep a shared tall of 0. Keep a shared foundnode of 0. Keep a shared celltext as empty text.\nTo measure from node (a whole number) with depth (a whole number). If node is less than 0, return. If depth is more than height, set height to depth. Measure from item node of lefts with depth plus 1. Measure from item node of rights with depth plus 1.\n\nTo mark from node (a whole number) with level (a whole number) and place (a whole number). If node is less than 0, return. Set item node of depths to level. Set item node of places to place. The steps is tall minus 2 minus level. The gap is shift 1 left by steps. The leftplace is place minus gap. The rightplace is place plus gap. Mark from item node of lefts with level plus 1 and leftplace. Mark from item node of rights with level plus 1 and rightplace.\n\nTo find at row (a whole number) with column (a whole number). The pick is -1.\nFor every node from 0 to the last position of values.\nIf item node of depths is row and item node of places is column, set pick to node. Set foundnode to pick.\n\nTo describe from node (a whole number). The piece is format whole number item node of values as text. Set celltext to piece.\n\nMeasure from 0 with 1. Set tall to height. The wide is 1. The steps is 0.\nRepeat while steps is less than tall.\nSet wide to wide times 2. Add 1 to steps.\n\nDecrease wide by 1. The middle is wide minus 1. Set middle to middle divided by 2. The gap is wide plus 1. Set gap to gap divided by 4.\nFor every node from 0 to 3.\nPlace 0 into depths. Place 0 into places.\n\nMark from 0 with 0 and middle. The line is empty text. Place \"[\" into line.\nFor every row from 0 to tall minus 1.\nIf row is more than 0, Place \",\" into line. Place \"[\" into line.\nFor every column from 0 to wide minus 1.\nIf column is more than 0, Place \",\" into line. Place \"\\\"\" into line. Find at row with column. The celltext is empty text. If foundnode is at least 0, describe from foundnode. Place celltext into line. Place \"\\\"\" into line. If column is wide minus 1, Place \"]\" into line.\n\nPlace \"]\" into line. Show line.\n","expected":"[[\"\",\"\",\"\",\"1\",\"\",\"\",\"\"],[\"\",\"2\",\"\",\"\",\"\",\"3\",\"\"],[\"\",\"\",\"4\",\"\",\"\",\"\",\"\"]]\n","step_budget":2000000},{"id":657,"slug":"robot-return-to-origin","title":"Robot Return to Origin","difficulty":"Easy","category":"String","code":"The moves is \"UD\". The sideways is 0. The upward is 0. The last is the last position of moves.\nFor every spot from 0 to last.\nThe step is the slice of moves from spot to spot plus 1. If step matches \"U\", add 1 to upward. If step matches \"D\", subtract 1 from upward. If step matches \"L\", subtract 1 from sideways. If step matches \"R\", add 1 to sideways.\n\nIf sideways is 0 and upward is 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":658,"slug":"find-k-closest-elements","title":"Find K Closest Elements","difficulty":"Medium","category":"Array","code":"The values is a list of 1, 2, 3, 4, and 5. The want is 4. The aim is 3. The left is 0. The right is the last position of values.\nRepeat while right minus left plus 1 is more than want.\nThe lowgap is item left of values minus aim. Set lowgap to the absolute value of lowgap. The highgap is item right of values minus aim. Set highgap to the absolute value of highgap. If lowgap is at most highgap, subtract 1 from right, otherwise add 1 to left.\n\nThe line is empty text.\nFor every spot from left to right.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number item spot of values as text into line.\n\nShow line.\n","expected":"1,2,3,4\n","step_budget":2000000},{"id":659,"slug":"split-array-into-consecutive-subsequences","title":"Split Array into Consecutive Subsequences","difficulty":"Medium","category":"Array","code":"Keep a shared counts as an empty list of whole numbers. Keep a shared ends as an empty list of whole numbers. Keep a shared possible of 0.\nTo lengthen from value (a whole number).\nRepeat while item value of counts is more than 0.\nThe onward is 0. If value is more than 0 and item (value minus 1) of ends is more than 0, set onward to 1. If onward is 1, set item (value minus 1) of ends to item (value minus 1) of ends minus 1. If onward is 1, set item value of ends to item value of ends plus 1. If onward is 1, set item value of counts to item value of counts minus 1. The fresh is 0. If onward is 0 and value is at most 7 and item (value plus 1) of counts is more than 0 and item (value plus 2) of counts is more than 0, set fresh to 1. If fresh is 1, set item value of counts to item value of counts minus 1. If fresh is 1, set item (value plus 1) of counts to item (value plus 1) of counts minus 1. If fresh is 1, set item (value plus 2) of counts to item (value plus 2) of counts minus 1. If fresh is 1, set item (value plus 2) of ends to item (value plus 2) of ends plus 1. If onward is 0 and fresh is 0, set possible to 0, set item value of counts to 0.\n\nThe numbers is a list of 1, 2, 3, 3, 4, and 5.\nFor every value from 0 to 9.\nPlace 0 into counts. Place 0 into ends.\n\nFor each value in numbers.\nIncrease item value of counts by 1.\n\nSet possible to 1.\nFor every value from 0 to 9.\nLengthen from value. If possible is 0, stop.\n\nIf possible is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":661,"slug":"image-smoother","title":"Image Smoother","difficulty":"Easy","category":"Array","code":"Keep a shared grid as an empty list of whole numbers. Keep a shared average of 0.\nTo smooth at row (a whole number) with column (a whole number). The total is 0. The count is 0.\nFor every offset from 0 to 8.\nThe down is offset divided by 3 minus 1. The across is offset modulo 3 minus 1. The actualrow is row plus down. The actualcolumn is column plus across. The inside is 0. If actualrow is at least 0 and actualrow is less than 3 and actualcolumn is at least 0 and actualcolumn is less than 3, set inside to 1. If inside is 1, set total to total plus item (actualrow times 3 plus actualcolumn) of grid. If inside is 1, add 1 to count. If offset is 8, set average to total divided by count.\n\nThe grid is a list of 1, 1, 1, 1, 0, 1, 1, 1, and 1. The line is empty text. Place \"[\" into line.\nFor every row from 0 to 2.\nIf row is more than 0, Place \",\" into line. Place \"[\" into line.\nFor every column from 0 to 2.\nIf column is more than 0, Place \",\" into line. Smooth at row with column. Place format whole number average as text into line. If column is 2, Place \"]\" into line.\n\nPlace \"]\" into line. Show line.\n","expected":"[[0,0,0],[0,0,0],[0,0,0]]\n","step_budget":2000000},{"id":662,"slug":"maximum-width-of-binary-tree","title":"Maximum Width of Binary Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 3, 2, 5, 3, and 9. Keep a shared lefts holding 1, 3, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 5, -1, -1, and -1. The queue is an empty list of whole numbers. The places is an empty list of whole numbers. Place 0 into queue. Place 0 into places. The head is 0. The count is 1. The remaining is 1. The nextcount is 0. The width is 0. The first is 1000000. The last is -1.\nRepeat while head is less than count.\nThe node is item head of queue. The spot is item head of places. Add 1 to head. If spot is less than first, set first to spot. If spot is more than last, set last to spot. If item node of lefts is at least 0, Place item node of lefts into queue, Place spot times 2 plus 1 into places, add 1 to count, add 1 to nextcount. If item node of rights is at least 0, Place item node of rights into queue, Place spot times 2 plus 2 into places, add 1 to count, add 1 to nextcount. Subtract 1 from remaining. The span is last minus first plus 1. The ended is 0. If remaining is 0, set ended to 1. If ended is 1 and span is more than width, set width to span. If ended is 1, set first to 1000000. If ended is 1, set last to -1. If ended is 1, set remaining to nextcount. If ended is 1, set nextcount to 0.\n\nShow width.\n","expected":"4\n","step_budget":2000000},{"id":664,"slug":"strange-printer","title":"Strange Printer","difficulty":"Hard","category":"String","code":"The word is \"aaabbb\". The size is the length of word. The table is a list of 36 zeros.\nFor every spot from 0 to size minus 1.\nSet item (spot times size plus spot) of table to 1.\n\nFor every span from 2 to size.\nFor every start from 0 to size minus span.\nThe finish is start plus span minus 1. The opener is item ((start plus 1) times size plus finish) of table plus 1.\nFor every split from start plus 1 to finish.\nThe firstletter is the slice of word from start to start plus 1. The otherletter is the slice of word from split to split plus 1. The same is 0. If firstletter matches otherletter, set same to 1. The leftpart is 0. If split is more than start plus 1, set leftpart to item ((start plus 1) times size plus split minus 1) of table. The option is leftpart plus item (split times size plus finish) of table. If same is 1 and option is less than opener, set opener to option. If split is finish, set item (start times size plus finish) of table to opener.\n\nShow item (size minus 1) of table.\n","expected":"2\n","step_budget":2000000},{"id":665,"slug":"non-decreasing-array","title":"Non-decreasing Array","difficulty":"Medium","category":"Array","code":"The numbers is a list of 4, 2, and 3. The last is the last position of numbers. The changes is 0.\nFor every spot from 1 to last.\nThe previous is item (spot minus 1) of numbers. The current is item spot of numbers. The drop is 0. If current is less than previous, set drop to 1. If drop is 1, add 1 to changes. The lowerok is 0. If spot is 1, set lowerok to 1. If spot is more than 1 and item (spot minus 2) of numbers is at most current, set lowerok to 1. If drop is 1 and lowerok is 1, set item (spot minus 1) of numbers to current. If drop is 1 and lowerok is 0, set item spot of numbers to previous.\n\nIf changes is at most 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":667,"slug":"beautiful-arrangement-ii","title":"Beautiful Arrangement II","difficulty":"Medium","category":"Array","code":"The size is 3. The spread is 2. The low is 1. The high is size. The answer is an empty list of whole numbers.\nFor every step from 0 to spread minus 1.\nIf step modulo 2 is 0, Place low into answer, add 1 to low. If step modulo 2 is 1, Place high into answer, subtract 1 from high.\n\nIf spread modulo 2 is 0.\nRepeat while low is at most high.\nPlace low into answer. Add 1 to low.\n\nIf spread modulo 2 is 1.\nRepeat while low is at most high.\nPlace high into answer. Subtract 1 from high.\n\nThe line is empty text.\nFor each value in answer.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number value as text into line.\n\nShow line.\n","expected":"1,3,2\n","step_budget":2000000},{"id":668,"slug":"kth-smallest-number-in-multiplication-table","title":"Kth Smallest Number in Multiplication Table","difficulty":"Hard","category":"Math","code":"Keep a shared total of 0. Keep a shared rows of 0. Keep a shared columns of 0.\nTo count up to bound (a whole number). Set total to 0.\nFor every row from 1 to rows.\nThe full is bound divided by row. The take is full. If take is more than columns, set take to columns. Increase total by take.\n\nSet rows to 3. Set columns to 3. The target is 5. The low is 1. The high is rows times columns.\nRepeat while low is less than high.\nThe middle is low plus high. Set middle to middle divided by 2. Count up to middle. If total is at least target, set high to middle, otherwise set low to middle plus 1.\n\nShow low.\n","expected":"3\n","step_budget":2000000},{"id":669,"slug":"trim-a-binary-search-tree","title":"Trim a Binary Search Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 0, and 2. Keep a shared lefts holding 1, -1, and -1. Keep a shared rights holding 2, -1, and -1. Keep a shared queue as an empty list of whole numbers. Keep a shared pieces as an empty list of text. Keep a shared count of 0. Keep a shared low of 0. Keep a shared high of 0. Keep a shared trimmed of 0.\nTo trim from node (a whole number). If node is less than 0, set trimmed to -1, return. The here is node. If item here of values is less than low, trim from item here of rights, return. If item here of values is more than high, trim from item here of lefts, return. Trim from item here of lefts. Set item here of lefts to trimmed. Trim from item here of rights. Set item here of rights to trimmed. Set trimmed to here.\n\nTo emit from node (a whole number). If node is less than 0, Place \"null\" into pieces, return. The piece is format whole number item node of values as text. Place piece into pieces. Place item node of lefts into queue. Place item node of rights into queue. Add 2 to count.\n\nSet low to 1. Set high to 2. Trim from 0. Place trimmed into queue. Set count to 1. The head is 0.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Emit from node.\n\nRepeat while the last position of pieces is at least 0.\nThe tail is the last position of pieces. The tailpiece is item tail of pieces. The isnull is 0. If tailpiece matches \"null\", set isnull to 1. If isnull is 1, remove the last item from pieces. If isnull is 0, stop.\n\nThe line is join pieces with \",\". Show line.\n","expected":"1,null,2\n","step_budget":2000000},{"id":670,"slug":"maximum-swap","title":"Maximum Swap","difficulty":"Medium","category":"Math","code":"Keep a shared digits as an empty list of whole numbers. Keep a shared total of 0.\nTo fold. Set total to 0.\nFor each digit in digits.\nSet total to total times 10 plus digit.\n\nThe number is 2736. The rest is number.\nRepeat while rest is more than 0.\nPlace rest modulo 10 into digits. Set rest to rest divided by 10.\n\nThe last is the last position of digits. The half is last divided by 2.\nFor every left from 0 to half.\nSwap item left of digits and item (last minus left) of digits.\n\nThe best is number.\nFor every first from 0 to last.\nFor every second from first plus 1 to last.\nSwap item first of digits and item second of digits. Fold. If total is more than best, set best to total. Swap item first of digits and item second of digits.\n\nShow best.\n","expected":"7236\n","step_budget":2000000},{"id":671,"slug":"second-minimum-node-in-a-binary-tree","title":"Second Minimum Node In a Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 2, 2, 5, 5, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1. Keep a shared base of 0. Keep a shared higher of 0.\nTo inspect from node (a whole number). If node is less than 0, return. The value is item node of values. If value is more than base and value is less than higher, set higher to value. Inspect from item node of lefts. Inspect from item node of rights.\n\nSet base to item 0 of values. Set higher to 1000000. Inspect from 0. If higher is 1000000, show -1, otherwise show higher.\n","expected":"5\n","step_budget":2000000},{"id":672,"slug":"bulb-switcher-ii","title":"Bulb Switcher II","difficulty":"Medium","category":"Math","code":"The size is 1. The presses is 1. The patterns is 1.\nFor every step from 1 to size.\nSet patterns to patterns times 2.\n\nThe allmask is patterns minus 1. The evenmask is 0. The oddmask is 0. The triplemask is 0.\nFor every spot from 0 to size minus 1.\nThe bit is shift 1 left by spot. If spot modulo 2 is 0, set evenmask to bitwise or of evenmask and bit. If spot modulo 2 is 1, set oddmask to bitwise or of oddmask and bit. If spot modulo 3 is 0, set triplemask to bitwise or of triplemask and bit.\n\nThe rounds is presses plus 1. The limit is rounds times patterns. The seen is an empty list of whole numbers.\nFor every spot from 0 to limit minus 1.\nPlace 0 into seen.\n\nThe queue is an empty list of whole numbers. The depths is an empty list of whole numbers. Place 0 into queue. Place 0 into depths. Set item 0 of seen to 1. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe state is item head of queue. The round is item head of depths. Add 1 to head. The flipped is exclusive or of state and allmask. The flipspot is (round plus 1) times patterns plus flipped. If round is less than presses and item flipspot of seen is 0, set item flipspot of seen to 1, Place flipped into queue, Place round plus 1 into depths, add 1 to count. The evenstate is exclusive or of state and evenmask. The evenspot is (round plus 1) times patterns plus evenstate. If round is less than presses and item evenspot of seen is 0, set item evenspot of seen to 1, Place evenstate into queue, Place round plus 1 into depths, add 1 to count. The oddstate is exclusive or of state and oddmask. The oddspot is (round plus 1) times patterns plus oddstate. If round is less than presses and item oddspot of seen is 0, set item oddspot of seen to 1, Place oddstate into queue, Place round plus 1 into depths, add 1 to count. The triplestate is exclusive or of state and triplemask. The triplespot is (round plus 1) times patterns plus triplestate. If round is less than presses and item triplespot of seen is 0, set item triplespot of seen to 1, Place triplestate into queue, Place round plus 1 into depths, add 1 to count.\n\nThe answer is 0.\nFor every state from 0 to patterns minus 1.\nIf item (presses times patterns plus state) of seen is 1, add 1 to answer.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":673,"slug":"number-of-longest-increasing-subsequence","title":"Number of Longest Increasing Subsequence","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 3, 5, 4, and 7. The last is the last position of numbers. The lengths is a list of 5 zeros. The counts is a list of 5 zeros.\nFor every spot from 0 to last.\nSet item spot of lengths to 1. Set item spot of counts to 1.\nFor every prior from 0 to spot minus 1.\nThe candidate is item prior of lengths plus 1. The lower is 0. If item prior of numbers is less than item spot of numbers, set lower to 1. The raised is 0. If lower is 1 and candidate is more than item spot of lengths, set raised to 1. If raised is 1, set item spot of lengths to candidate, set item spot of counts to item prior of counts. If lower is 1 and raised is 0 and candidate is item spot of lengths, set item spot of counts to item spot of counts plus item prior of counts.\n\nThe best is 0.\nFor every spot from 0 to last.\nIf item spot of lengths is more than best, set best to item spot of lengths.\n\nThe total is 0.\nFor every spot from 0 to last.\nIf item spot of lengths is best, set total to total plus item spot of counts.\n\nShow total.\n","expected":"2\n","step_budget":2000000},{"id":674,"slug":"longest-continuous-increasing-subsequence","title":"Longest Continuous Increasing Subsequence","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 3, 5, 4, and 7. The last is the last position of numbers. The longest is 1. The run is 1.\nFor every spot from 1 to last.\nIf item spot of numbers is more than item (spot minus 1) of numbers, add 1 to run, otherwise set run to 1. If run is more than longest, set longest to run.\n\nShow longest.\n","expected":"3\n","step_budget":2000000},{"id":675,"slug":"cut-off-trees-for-golf-event","title":"Cut Off Trees for Golf Event","difficulty":"Hard","category":"Array","code":"Keep a shared grid holding 1, 2, 3, 0, 0, 4, 7, 6, and 5. Keep a shared rows of 0. Keep a shared columns of 0. Keep a shared currentrow of 0. Keep a shared currentcolumn of 0. Keep a shared travelled of 0. Set rows to 3. Set columns to 3.\nTo walk to targetrow (a whole number) with targetcolumn (a whole number). The queue is an empty list of whole numbers. The steps is an empty list of whole numbers. The seen is a list of 9 zeros. The start is currentrow times columns plus currentcolumn. Place start into queue. Place 0 into steps. Set item start of seen to 1. Set travelled to 0. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe cell is item head of queue. The depth is item head of steps. Add 1 to head. The row is cell divided by columns. The column is cell modulo columns. The hit is 0. If row is targetrow and column is targetcolumn, set hit to 1. If hit is 1, set travelled to depth. If hit is 1, stop. The uprow is row minus 1. The upcolumn is column. The upinside is 0. If uprow is at least 0 and uprow is less than rows and upcolumn is at least 0 and upcolumn is less than columns, set upinside to 1. The upblocked is 0. If upinside is 1 and item (uprow times columns plus upcolumn) of grid is 0, set upblocked to 1. The upseen is 0. If upinside is 1 and item (uprow times columns plus upcolumn) of seen is 1, set upseen to 1. If upinside is 1 and upblocked is 0 and upseen is 0, set item (uprow times columns plus upcolumn) of seen to 1, Place (uprow times columns plus upcolumn) into queue, Place depth plus 1 into steps, add 1 to count. The downrow is row plus 1. The downcolumn is column. The downinside is 0. If downrow is at least 0 and downrow is less than rows and downcolumn is at least 0 and downcolumn is less than columns, set downinside to 1. The downblocked is 0. If downinside is 1 and item (downrow times columns plus downcolumn) of grid is 0, set downblocked to 1. The downseen is 0. If downinside is 1 and item (downrow times columns plus downcolumn) of seen is 1, set downseen to 1. If downinside is 1 and downblocked is 0 and downseen is 0, set item (downrow times columns plus downcolumn) of seen to 1, Place (downrow times columns plus downcolumn) into queue, Place depth plus 1 into steps, add 1 to count. The leftrow is row. The leftcolumn is column minus 1. The leftinside is 0. If leftrow is at least 0 and leftrow is less than rows and leftcolumn is at least 0 and leftcolumn is less than columns, set leftinside to 1. The leftblocked is 0. If leftinside is 1 and item (leftrow times columns plus leftcolumn) of grid is 0, set leftblocked to 1. The leftseen is 0. If leftinside is 1 and item (leftrow times columns plus leftcolumn) of seen is 1, set leftseen to 1. If leftinside is 1 and leftblocked is 0 and leftseen is 0, set item (leftrow times columns plus leftcolumn) of seen to 1, Place (leftrow times columns plus leftcolumn) into queue, Place depth plus 1 into steps, add 1 to count. The rightrow is row. The rightcolumn is column plus 1. The rightinside is 0. If rightrow is at least 0 and rightrow is less than rows and rightcolumn is at least 0 and rightcolumn is less than columns, set rightinside to 1. The rightblocked is 0. If rightinside is 1 and item (rightrow times columns plus rightcolumn) of grid is 0, set rightblocked to 1. The rightseen is 0. If rightinside is 1 and item (rightrow times columns plus rightcolumn) of seen is 1, set rightseen to 1. If rightinside is 1 and rightblocked is 0 and rightseen is 0, set item (rightrow times columns plus rightcolumn) of seen to 1, Place (rightrow times columns plus rightcolumn) into queue, Place depth plus 1 into steps, add 1 to count.\n\nThe heights is an empty list of whole numbers. The treerows is an empty list of whole numbers. The treecolumns is an empty list of whole numbers.\nFor every spot from 0 to 8.\nThe height is item spot of grid.\nIf height is more than 1.\nThe treerow is spot divided by columns. The treecolumn is spot modulo columns. Place height into heights. Place treerow into treerows. Place treecolumn into treecolumns.\n\nThe treelast is the last position of heights.\nFor every left from 0 to treelast.\nFor every right from left plus 1 to treelast.\nIf item right of heights is less than item left of heights, swap item left of heights and item right of heights, swap item left of treerows and item right of treerows, swap item left of treecolumns and item right of treecolumns.\n\nThe total is 0.\nFor every tree from 0 to treelast.\nWalk to item tree of treerows with item tree of treecolumns. Increase total by travelled. Set currentrow to item tree of treerows. Set currentcolumn to item tree of treecolumns.\n\nShow total.\n","expected":"6\n","step_budget":2000000},{"id":678,"slug":"valid-parenthesis-string","title":"Valid Parenthesis String","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Keep a shared possible as an empty list of whole numbers. Keep a shared fresh as an empty list of whole numbers. Keep a shared limit of 0. Place \"(*))\" into source.\nFor every slot from 0 to 102.\nPlace 0 into possible. Place 0 into fresh.\n\nSet limit to the last position of source. Set item 0 of possible to 1.\n\nTo wipe from marker (a whole number).\nFor every balance from 0 to limit.\nSet item balance of fresh to 0.\n\nTo advance from spot (a whole number).\nFor every balance from 0 to limit.\nIf item balance of possible is 1 and character spot of source is \"(\" and balance is less than limit, set item (balance plus 1) of fresh to 1. If item balance of possible is 1 and character spot of source is \")\" and balance is more than 0, set item (balance minus 1) of fresh to 1. If item balance of possible is 1 and character spot of source is \"*\" and balance is less than limit, set item (balance plus 1) of fresh to 1. If item balance of possible is 1 and character spot of source is \"*\" and balance is more than 0, set item (balance minus 1) of fresh to 1. If item balance of possible is 1 and character spot of source is \"*\", set item balance of fresh to 1.\n\nTo adopt from marker (a whole number).\nFor every balance from 0 to limit.\nSet item balance of possible to item balance of fresh.\n\nFor every spot from 0 to limit.\nWipe from 0. Advance from spot. Adopt from 0.\n\nIf item 0 of possible is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":679,"slug":"24-game","title":"24 Game","difficulty":"Hard","category":"Array","code":"Keep a shared tops as an empty list of whole numbers. Keep a shared bottoms as an empty list of whole numbers. Keep a shared active as an empty list of whole numbers. Keep a shared found of 0. Keep a shared remaining of 0. Place 4 into tops. Place 1 into tops. Place 8 into tops. Place 7 into tops. Place 1 into bottoms. Place 1 into bottoms. Place 1 into bottoms. Place 1 into bottoms. Place 1 into active. Place 1 into active. Place 1 into active. Place 1 into active.\n\nTo count from spot (a whole number). If spot is more than 3, return. If item spot of active is 1, add 1 to remaining. Count from spot plus 1.\n\nTo settle from marker (a whole number).\nFor every spot from 0 to 3.\nIf item spot of active is 1 and item spot of bottoms is not 0 and item spot of tops is 24 times item spot of bottoms, set found to 1.\n\nTo explore from depth (a whole number). If found is 1, return. Set remaining to 0. Count from 0. If remaining is 1, settle from 0, return.\nFor every first from 0 to 3.\nFor every second from first plus 1 to 3.\nIf item first of active is 1 and item second of active is 1 and found is 0, attempt from first with second.\n\nTo addpair from first (a whole number) with second (a whole number). The firsttop is item first of tops. The firstbottom is item first of bottoms. The secondtop is item second of tops. The secondbottom is item second of bottoms. Set item first of tops to firsttop times secondbottom plus secondtop times firstbottom. Set item first of bottoms to firstbottom times secondbottom. If item first of bottoms is less than 0, set item first of tops to 0 minus item first of tops, set item first of bottoms to 0 minus item first of bottoms. Set item second of active to 0. Explore from 1. Set item second of active to 1. Set item first of tops to firsttop. Set item first of bottoms to firstbottom.\n\nTo cutpair from first (a whole number) with second (a whole number). The firsttop is item first of tops. The firstbottom is item first of bottoms. The secondtop is item second of tops. The secondbottom is item second of bottoms. Set item first of tops to firsttop times secondbottom minus secondtop times firstbottom. Set item first of bottoms to firstbottom times secondbottom. If item first of bottoms is less than 0, set item first of tops to 0 minus item first of tops, set item first of bottoms to 0 minus item first of bottoms. Set item second of active to 0. Explore from 1. Set item second of active to 1. Set item first of tops to firsttop. Set item first of bottoms to firstbottom.\n\nTo scalepair from first (a whole number) with second (a whole number). The firsttop is item first of tops. The firstbottom is item first of bottoms. The secondtop is item second of tops. The secondbottom is item second of bottoms. Set item first of tops to firsttop times secondtop. Set item first of bottoms to firstbottom times secondbottom. If item first of bottoms is less than 0, set item first of tops to 0 minus item first of tops, set item first of bottoms to 0 minus item first of bottoms. Set item second of active to 0. Explore from 1. Set item second of active to 1. Set item first of tops to firsttop. Set item first of bottoms to firstbottom.\n\nTo splitpair from first (a whole number) with second (a whole number). If item second of tops is 0, return. The firsttop is item first of tops. The firstbottom is item first of bottoms. The secondtop is item second of tops. The secondbottom is item second of bottoms. Set item first of tops to firsttop times secondbottom. Set item first of bottoms to firstbottom times secondtop. If item first of bottoms is less than 0, set item first of tops to 0 minus item first of tops, set item first of bottoms to 0 minus item first of bottoms. Set item second of active to 0. Explore from 1. Set item second of active to 1. Set item first of tops to firsttop. Set item first of bottoms to firstbottom.\n\nTo attempt from first (a whole number) with second (a whole number). If found is 1, return. If item first of active is 0, return. If item second of active is 0, return. If found is 0, addpair from first with second. If found is 0, cutpair from first with second. If found is 0, scalepair from first with second. If found is 0, splitpair from first with second.\n\nExplore from 1. If found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":680,"slug":"valid-palindrome-ii","title":"Valid Palindrome II","difficulty":"Easy","category":"String","code":"Keep a shared source as empty text. Keep a shared good of 0. Keep a shared verdict of 0. Keep a shared settled of 0. Place \"abca\" into source.\n\nTo palm from left (a whole number) with right (a whole number).\nRepeat while left is less than right.\nThe leftsymbol is character left of source. The rightsymbol is character right of source. If leftsymbol is not rightsymbol, set good to 0, return. Add 1 to left. Subtract 1 from right.\n\nTo resolve from first (a whole number) with last (a whole number). Set settled to 1. Set verdict to 1. Set good to 1. Palm from first plus 1 with last. If good is 1, return. Set good to 1. Palm from first with last minus 1. If good is 1, return. Set verdict to 0.\n\nThe first is 0. The last is the last position of source.\nRepeat while first is less than last and settled is 0.\nThe leftsymbol is character first of source. The rightsymbol is character last of source. If leftsymbol is not rightsymbol, resolve from first with last. If leftsymbol is rightsymbol, add 1 to first, subtract 1 from last.\n\nIf verdict is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":682,"slug":"baseball-game","title":"Baseball Game","difficulty":"Easy","category":"Array","code":"Keep a shared current as empty text. Keep a shared value of 0.\n\nTo read from spot (a whole number) with last (a whole number). If spot is more than last, return. The digit is the digit value of character spot of current. Set value to value times 10 plus digit. Read from spot plus 1 with last.\n\nThe operations is \"5,2,C,D,+\". The tokens is split operations by \",\". The scores is an empty list of whole numbers. The depth is 0.\nFor each token in tokens.\nSet current to a copy of token. The symbol is character 0 of current. If symbol is \"C\", remove the last item from scores, subtract 1 from depth. If symbol is \"D\", The doubled is item (depth minus 1) of scores times 2, Place doubled into scores, add 1 to depth. If symbol is \"+\", The joined is item (depth minus 1) of scores plus item (depth minus 2) of scores, Place joined into scores, add 1 to depth.\nIf symbol is between \"0\" and \"9\" or symbol is \"-\".\nSet value to 0. The sign is 1. The start is 0. If symbol is \"-\", set sign to -1, set start to 1. The lastchar is the last position of current. Read from start with lastchar. Set value to value times sign. Place value into scores. Add 1 to depth.\n\nThe total is 0. For each score in scores, add score to total.\n\nShow total.\n","expected":"30\n","step_budget":2000000},{"id":684,"slug":"redundant-connection","title":"Redundant Connection","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared parent as an empty list of whole numbers. Keep a shared rootanswer of 0.\nFor every node from 0 to 3.\nPlace node into parent.\n\nTo climb from node (a whole number). Set rootanswer to node. The cursor is rootanswer.\nRepeat while item cursor of parent is not cursor.\nSet rootanswer to item cursor of parent. Set cursor to rootanswer.\n\nThe edges is a list of 1, 2, 1, 3, 2, and 3. The count is 3. The found is 0. The firstanswer is 0. The secondanswer is 0.\nFor every edge from 0 to count minus 1.\nThe start is item (edge times 2) of edges. The finish is item (edge times 2 plus 1) of edges. Climb from start. The firstroot is rootanswer. Climb from finish. The secondroot is rootanswer. If found is 0 and firstroot is secondroot, set found to 1, set firstanswer to start, set secondanswer to finish. If found is 0 and firstroot is not secondroot, set item firstroot of parent to secondroot.\n\nThe line is empty text. The firstword is format whole number firstanswer as text. Place firstword into line. Place \",\" into line. The secondword is format whole number secondanswer as text. Place secondword into line. Show line.\n","expected":"2,3\n","step_budget":2000000},{"id":685,"slug":"redundant-connection-ii","title":"Redundant Connection II","difficulty":"Hard","category":"Depth-First Search","code":"Keep a shared sources as an empty list of whole numbers. Keep a shared targets as an empty list of whole numbers. Keep a shared indegree as an empty list of whole numbers. Keep a shared parentof as an empty list of whole numbers. Keep a shared total of 0. Keep a shared removededge of 0. Keep a shared valid of 0. Keep a shared answerone of 0. Keep a shared answertwo of 0. Place 1 into sources. Place 1 into sources. Place 2 into sources. Place 2 into targets. Place 3 into targets. Place 3 into targets. Set total to 3.\nFor every node from 0 to total.\nPlace 0 into indegree. Place 0 into parentof.\n\nTo reset from marker (a whole number).\nFor every node from 1 to total.\nSet item node of indegree to 0. Set item node of parentof to 0.\n\nTo count from edge (a whole number). If edge is removededge, return. The dest is item edge of targets. The origin is item edge of sources. Increase item dest of indegree by 1. Set item dest of parentof to origin.\n\nTo climb from node (a whole number) with steps (a whole number). If node is 1, return. If steps is more than total, set valid to 0, return. If node is less than 1, set valid to 0, return. Climb from item node of parentof with steps plus 1.\n\nTo verify from start (a whole number). Climb from start with 0.\n\nTo validate from marker (a whole number). Set valid to 1. If item 1 of indegree is not 0, set valid to 0.\nFor every node from 2 to total.\nIf item node of indegree is not 1, set valid to 0. If item node of indegree is 1, verify from node.\n\nTo check from removed (a whole number). Set removededge to removed. Reset from 0.\nFor every edge from 0 to total minus 1.\nCount from edge. Validate from 0.\n\nFor every forward from 0 to total minus 1.\nThe removed is total minus 1 minus forward. If answerone is 0, check from removed. If answerone is 0 and valid is 1, set answerone to item removed of sources, set answertwo to item removed of targets.\n\nThe line is empty text. The firstword is format whole number answerone as text. Place firstword into line. Place \",\" into line. The secondword is format whole number answertwo as text. Place secondword into line. Show line.\n","expected":"2,3\n","step_budget":2000000},{"id":686,"slug":"repeated-string-match","title":"Repeated String Match","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Keep a shared target as empty text. Keep a shared repeated as empty text. Keep a shared found of 0. Keep a shared count of 0. Place \"abcd\" into source. Place \"cdabcdab\" into target.\n\nTo seek from marker (a whole number). Set found to 0. The sourcefinal is the last position of repeated. The targetfinal is the last position of target. The final is sourcefinal minus targetfinal.\nFor every start from 0 to final.\nThe piece is the slice of repeated from start to start plus targetfinal plus 1. If piece matches target, set found to 1.\n\nTo extend from marker (a whole number). Place source into repeated. Add 1 to count. Seek from 0.\n\nSet count to 1. Place source into repeated.\nRepeat while the last position of repeated is less than the last position of target.\nPlace source into repeated. Add 1 to count.\n\nSeek from 0. If found is 0, extend from 0. If found is 0, set count to -1. Show count.\n","expected":"3\n","step_budget":2000000},{"id":687,"slug":"longest-univalue-path","title":"Longest Univalue Path","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared reach of 0. Keep a shared best of 0. Place 5 into values. Place 4 into values. Place 5 into values. Place 1 into values. Place 1 into values. Place 0 into values. Place 5 into values. Place 1 into lefts. Place 3 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place 2 into rights. Place -1 into rights. Place 6 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights.\n\nTo probe from node (a whole number). If node is less than 0, set reach to 0, return. The label is item node of values. The leftnode is item node of lefts. The rightnode is item node of rights. Set leftreach to 0. Set rightreach to 0. Probe from leftnode. Set leftreach to reach. If leftnode is at least 0 and item leftnode of values is label, add 1 to leftreach. If leftnode is at least 0 and item leftnode of values is not label, set leftreach to 0. Probe from rightnode. Set rightreach to reach. If rightnode is at least 0 and item rightnode of values is label, add 1 to rightreach. If rightnode is at least 0 and item rightnode of values is not label, set rightreach to 0. The across is leftreach plus rightreach. If across is more than best, set best to across. Set reach to leftreach. If rightreach is more than reach, set reach to rightreach.\n\nProbe from 0. Show best.\n","expected":"2\n","step_budget":2000000},{"id":688,"slug":"knight-probability-in-chessboard","title":"Knight Probability in Chessboard","difficulty":"Medium","category":"Dynamic Programming","code":"Keep a shared counts as an empty list of whole numbers. Keep a shared fresh as an empty list of whole numbers. Keep a shared downs as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared size of 0. Keep a shared steps of 0. Place 1 into downs. Place 1 into downs. Place -1 into downs. Place -1 into downs. Place 2 into downs. Place 2 into downs. Place -2 into downs. Place -2 into downs. Place 2 into rights. Place -2 into rights. Place 2 into rights. Place -2 into rights. Place 1 into rights. Place -1 into rights. Place 1 into rights. Place -1 into rights. Set size to 3. Set steps to 2.\nFor every spot from 0 to 8.\nPlace 0 into counts. Place 0 into fresh.\n\nSet item 0 of counts to 1.\n\nTo wipe from marker (a whole number).\nFor every spot from 0 to 8.\nSet item spot of fresh to 0.\n\nTo adopt from marker (a whole number).\nFor every spot from 0 to 8.\nSet item spot of counts to item spot of fresh.\n\nTo jump from cell (a whole number). The currentrow is cell divided by size. The currentcolumn is cell modulo size.\nFor every move from 0 to 7.\nThe nextrow is currentrow plus item move of downs. The nextcolumn is currentcolumn plus item move of rights.\nIf nextrow is at least 0 and nextrow is less than size and nextcolumn is at least 0 and nextcolumn is less than size.\nThe dest is nextrow times size plus nextcolumn. Increase item dest of fresh by item cell of counts.\n\nTo spread from cell (a whole number). If cell is at least 9, adopt from 0, return. If item cell of counts is more than 0, jump from cell. Spread from cell plus 1.\n\nTo begin from marker (a whole number). Wipe from 0. Spread from 0.\n\nFor every step from 1 to steps.\nBegin from 0.\n\nThe numerator is 0.\nFor every spot from 0 to 8.\nIncrease numerator by item spot of counts.\n\nThe denominator is 1.\nFor every step from 1 to steps.\nSet denominator to denominator times 8.\n\nThe headpart is numerator divided by denominator. The remainder is numerator modulo denominator. The parts is an empty list of text. The headword is format whole number headpart as text. Place headword into parts. Place \".\" into parts.\nFor every digit from 0 to 9.\nSet remainder to remainder times 10. The part is remainder divided by denominator. The digword is format whole number part as text. Place digword into parts. Set remainder to remainder modulo denominator.\n\nThe answer is join parts with \"\".\nRepeat while the last position of answer is more than 1.\nThe final is the last position of answer. The lastpiece is character final of answer. If lastpiece is \"0\", remove last character from answer. If lastpiece is not \"0\", stop.\n\nThe final is the last position of answer. The lastpiece is character final of answer. If lastpiece is \".\", remove last character from answer. Show answer.\n","expected":"0.0625\n","step_budget":2000000},{"id":689,"slug":"maximum-sum-of-3-non-overlapping-subarrays","title":"Maximum Sum of 3 Non-Overlapping Subarrays","difficulty":"Hard","category":"Array","code":"The numbers is a list of 1, 2, 1, 2, 6, 7, 5, and 1. The width is 2. The last is the last position of numbers. The best is -1. The bestfirst is 0. The bestsecond is 0. The bestclosing is 0. The firstlimit is last minus width times 3 plus 1. The secondlimit is last minus width times 2 plus 1. The closinglimit is last minus width plus 1.\nFor every first from 0 to firstlimit.\nFor every second from first plus width to secondlimit.\nFor every closing from second plus width to closinglimit.\nThe sum is 0.\nFor every spot from first to first plus width minus 1.\nIncrease sum by item spot of numbers.\nFor every spot from second to second plus width minus 1.\nIncrease sum by item spot of numbers.\nFor every spot from closing to closing plus width minus 1.\nIncrease sum by item spot of numbers.\nIf sum is more than best.\nSet best to sum. Set bestfirst to first. Set bestsecond to second. Set bestclosing to closing.\n\nThe line is empty text. The firstword is format whole number bestfirst as text. Place firstword into line. Place \",\" into line. The secondword is format whole number bestsecond as text. Place secondword into line. Place \",\" into line. The closingword is format whole number bestclosing as text. Place closingword into line. Show line.\n","expected":"0,3,5\n","step_budget":2000000},{"id":690,"slug":"employee-importance","title":"Employee Importance","difficulty":"Medium","category":"Array","code":"Keep a shared identifiers as an empty list of whole numbers. Keep a shared values as an empty list of whole numbers. Keep a shared counts as an empty list of whole numbers. Keep a shared starts as an empty list of whole numbers. Keep a shared subordinates as an empty list of whole numbers. Keep a shared total of 0. Keep a shared foundindex of 0. Place 1 into identifiers. Place 2 into identifiers. Place 3 into identifiers. Place 5 into values. Place 3 into values. Place 3 into values. Place 2 into counts. Place 0 into counts. Place 0 into counts. Place 0 into starts. Place 2 into starts. Place 2 into starts. Place 2 into subordinates. Place 3 into subordinates.\n\nTo locate from spot (a whole number) with wanted (a whole number). If foundindex is at least 0, return. If spot is more than 2, return. If item spot of identifiers is wanted, set foundindex to spot, return. Locate from spot plus 1 with wanted.\n\nTo gather from spot (a whole number). Increase total by item spot of values. The degree is item spot of counts. If degree is 0, return. The base is item spot of starts.\nFor every offset from 0 to degree minus 1.\nThe childid is item (base plus offset) of subordinates. Set foundindex to -1. Locate from 0 with childid. Gather from foundindex.\n\nGather from 0. Show total.\n","expected":"11\n","step_budget":2000000},{"id":691,"slug":"stickers-to-spell-word","title":"Stickers to Spell Word","difficulty":"Hard","category":"Array","code":"Keep a shared target as empty text. Keep a shared stickers as an empty list of text. Keep a shared letters as an empty list of text. Keep a shared bits as an empty list of whole numbers. Keep a shared costs as an empty list of whole numbers. Keep a shared currentsticker as empty text. Keep a shared letter as empty text. Keep a shared nextmask of 0. Keep a shared matchpos of 0. Place \"thehat\" into target. Place \"with\" into stickers. Place \"example\" into stickers. Place \"science\" into stickers.\nFor every spot from 0 to the last position of target.\nThe piece is the slice of target from spot to spot plus 1. Place piece into letters.\n\nPlace 1 into bits.\nFor every step from 1 to 6.\nThe ending is the last position of bits. The prior is item ending of bits. The doubled is prior times 2. Place doubled into bits.\n\nFor every spot from 0 to 63.\nPlace 999 into costs.\n\nSet item 0 of costs to 0.\n\nTo find from spot (a whole number). If matchpos is at least 0, return. If spot is more than the last position of letters, return. The raised is item spot of bits. The bit is bitwise and of nextmask and raised. If bit is not 0, find from spot plus 1, return. If item spot of letters matches letter, set matchpos to spot, return. Find from spot plus 1.\n\nTo paste from marker (a whole number). The final is the last position of currentsticker.\nFor every spot from 0 to final.\nSet letter to the slice of currentsticker from spot to spot plus 1. Set matchpos to -1. Find from 0. The slot is matchpos. If slot is at least 0, set nextmask to nextmask plus item slot of bits.\n\nTo apply from mask (a whole number).\nFor every index from 0 to the last position of stickers.\nSet currentsticker to item index of stickers. Set nextmask to mask. Paste from index. The start is mask. The candidate is item start of costs plus 1. The slot is nextmask. If item slot of costs is more than candidate, set item slot of costs to candidate.\n\nFor every mask from 0 to 63.\nIf item mask of costs is less than 999, apply from mask.\n\nShow item 63 of costs.\n","expected":"3\n","step_budget":2000000},{"id":692,"slug":"top-k-frequent-words","title":"Top K Frequent Words","difficulty":"Medium","category":"Array","code":"Keep a shared words as an empty list of text. Keep a shared distinct as an empty list of text. Keep a shared frequencies as an empty list of whole numbers. Keep a shared chosen as an empty list of whole numbers. Keep a shared wanted as empty text. Keep a shared foundindex of 0. Keep a shared bestindex of 0. Place \"i\" into words. Place \"love\" into words. Place \"leetcode\" into words. Place \"i\" into words. Place \"love\" into words. Place \"coding\" into words.\n\nTo locate from spot (a whole number). If foundindex is at least 0, return. If spot is more than the last position of distinct, return. If item spot of distinct matches wanted, set foundindex to spot, return. Locate from spot plus 1.\n\nTo consider from spot (a whole number). If item spot of chosen is 1, return. If bestindex is less than 0, set bestindex to spot, return. The candidatecount is item spot of frequencies. The local is bestindex. The bestcount is item local of frequencies. If candidatecount is more than bestcount, set bestindex to spot, return. If candidatecount is less than bestcount, return. The localbest is bestindex. If item spot of distinct comes before item localbest of distinct, set bestindex to spot.\n\nTo choose from marker (a whole number). Set bestindex to -1.\nFor every spot from 0 to the last position of distinct.\nConsider from spot.\n\nFor each word in words.\nSet wanted to word. Set foundindex to -1. Locate from 0. If foundindex is at least 0, The local is foundindex, set item local of frequencies to item local of frequencies plus 1. If foundindex is less than 0, Place word into distinct, Place 1 into frequencies.\n\nFor every spot from 0 to the last position of distinct.\nPlace 0 into chosen.\n\nFor every pick from 1 to 2.\nChoose from 0. The local is bestindex. Show item local of distinct. Set item local of chosen to 1.\n","expected":"i\nlove\n","step_budget":2000000},{"id":693,"slug":"binary-number-with-alternating-bits","title":"Binary Number with Alternating Bits","difficulty":"Easy","category":"Bit Manipulation","code":"The value is 5. The current is value. The previous is current modulo 2. Set current to current divided by 2. The good is 1.\nRepeat while current is more than 0.\nThe bit is current modulo 2. If bit is previous, set good to 0. Set previous to bit. Set current to current divided by 2.\n\nIf good is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":695,"slug":"max-area-of-island","title":"Max Area of Island","difficulty":"Medium","category":"Array","code":"Keep a shared cells as an empty list of whole numbers. Keep a shared visited as an empty list of whole numbers. Keep a shared area of 0. Keep a shared best of 0. The picture is \"0010000100000,0000000111000,0110100000000,0100110010100,0100110011100,0000000000100,0000000111000,0000000110000\". The rows is split picture by \",\".\nFor each band in rows.\nFor every column from 0 to 12.\nThe digit is the digit value of character column of band. Place digit into cells.\n\nFor every spot from 0 to 103.\nPlace 0 into visited.\n\nTo sink from node (a whole number). If node is less than 0, return. If item node of visited is 1, return. If item node of cells is 0, return. Set item node of visited to 1. Add 1 to area. The rowspot is node divided by 13. The columnspot is node modulo 13. If rowspot is more than 0, sink from node minus 13. If rowspot is less than 7, sink from node plus 13. If columnspot is more than 0, sink from node minus 1. If columnspot is less than 12, sink from node plus 1.\n\nTo probe from node (a whole number). Set area to 0. Sink from node. If area is more than best, set best to area.\n\nFor every node from 0 to 103.\nIf item node of cells is 1 and item node of visited is 0, probe from node.\n\nShow best.\n","expected":"6\n","step_budget":2000000},{"id":696,"slug":"count-binary-substrings","title":"Count Binary Substrings","difficulty":"Easy","category":"String","code":"The source is \"00110011\". The last is the last position of source. The previous is 0. The current is 1. The total is 0.\nFor every spot from 1 to last.\nThe rightletter is character spot of source. The leftletter is character (spot minus 1) of source. If rightletter is leftletter, add 1 to current. If rightletter is not leftletter, The joined is the smaller of previous and current, add joined to total, set previous to current, set current to 1.\n\nThe extra is the smaller of previous and current. Add extra to total. Show total.\n","expected":"6\n","step_budget":2000000},{"id":697,"slug":"degree-of-an-array","title":"Degree of an Array","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 2, 2, 3, and 1. The counts is a list of 100 zeros. The firsts is an empty list of whole numbers. The lasts is an empty list of whole numbers.\nFor every spot from 0 to 99.\nPlace -1 into firsts. Place -1 into lasts.\n\nThe last is the last position of numbers.\nFor every spot from 0 to last.\nThe value is item spot of numbers. Increase item value of counts by 1. If item value of firsts is -1, set item value of firsts to spot. Set item value of lasts to spot.\n\nThe degree is 0.\nFor every value from 0 to 99.\nIf item value of counts is more than degree, set degree to item value of counts.\n\nThe best is 1000000.\nFor every value from 0 to 99.\nIf item value of counts is degree.\nThe width is item value of lasts minus item value of firsts plus 1. If width is less than best, set best to width.\n\nShow best.\n","expected":"2\n","step_budget":2000000},{"id":698,"slug":"partition-to-k-equal-sum-subsets","title":"Partition to K Equal Sum Subsets","difficulty":"Medium","category":"Array","code":"Keep a shared numbers as an empty list of whole numbers. Keep a shared groups as an empty list of whole numbers. Keep a shared count of 0. Keep a shared bins of 0. Keep a shared target of 0. Keep a shared found of 0. Place 4 into numbers. Place 3 into numbers. Place 2 into numbers. Place 3 into numbers. Place 5 into numbers. Place 2 into numbers. Place 1 into numbers. Set count to 7. Set bins to 4. The total is 0.\nFor each value in numbers.\nIncrease total by value.\n\nSet target to total divided by bins. Sort numbers.\nFor every group from 0 to bins minus 1.\nPlace 0 into groups.\n\nTo trygroup from spot (a whole number) with group (a whole number). If found is 1, return. The here is count minus 1 minus spot. The value is item here of numbers. If item group of groups plus value is more than target, return. Increase item group of groups by value. Fill from spot plus 1. Decrease item group of groups by value.\n\nTo fill from spot (a whole number). If found is 1, return. If spot is at least count, set found to 1, return.\nFor every group from 0 to bins minus 1.\nTrygroup from spot with group.\n\nFill from 0. If found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":699,"slug":"falling-squares","title":"Falling Squares","difficulty":"Hard","category":"Array","code":"Keep a shared lefts as an empty list of whole numbers. Keep a shared sizes as an empty list of whole numbers. Keep a shared tops as an empty list of whole numbers. Keep a shared base of 0. Keep a shared candidate of 0. Place 1 into lefts. Place 2 into lefts. Place 6 into lefts. Place 2 into sizes. Place 3 into sizes. Place 1 into sizes.\n\nTo measure from block (a whole number) at opening (a whole number) with closing (a whole number). Set base to 0.\nFor every before from 0 to block minus 1.\nThe otherleft is item before of lefts. The otherright is otherleft plus item before of sizes.\nIf otherleft is less than closing and opening is less than otherright.\nSet candidate to item before of tops. If candidate is more than base, set base to candidate.\n\nThe last is the last position of lefts. The best is 0.\nFor every block from 0 to last.\nThe front is item block of lefts. The back is front plus item block of sizes. Measure from block at front with back. The height is base plus item block of sizes. Place height into tops. If height is more than best, set best to height. Show best.\n","expected":"2\n5\n5\n","step_budget":2000000},{"id":700,"slug":"search-in-a-binary-search-tree","title":"Search in a Binary Search Tree","difficulty":"Easy","category":"Tree","code":"The values is a list of 4, 2, 7, 1, and 3. The lefts is a list of 1, 3, -1, -1, and -1. The rights is a list of 2, 4, -1, -1, and -1. The wanted is 2. The node is 0.\nRepeat while node is at least 0 and item node of values is not wanted.\nIf item node of values is more than wanted, set node to item node of lefts. If item node of values is less than wanted, set node to item node of rights.\n\nThe queue is an empty list of whole numbers. Place node into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe current is item head of queue. Add 1 to head. Show item current of values. The left is item current of lefts. The right is item current of rights. If left is at least 0, Place left into queue, add 1 to count. If right is at least 0, Place right into queue, add 1 to count.\n","expected":"2\n1\n3\n","step_budget":2000000},{"id":701,"slug":"insert-into-a-binary-search-tree","title":"Insert into a Binary Search Tree","difficulty":"Medium","category":"Tree","code":"The key is 5. Keep a shared values holding 4, 2, 7, 1, 3, and key. Keep a shared lefts holding 1, 3, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, -1, and -1. Keep a shared newspot of the last position of values.\n\nTo attach from node (a whole number) with key (a whole number). If key is less than item node of values, Step left from node with key, return. Step later from node with key.\n\nTo step left from node (a whole number) with key (a whole number). The left is item node of lefts. If left is less than 0, set item node of lefts to newspot, return. Attach from left with key.\n\nTo step later from node (a whole number) with key (a whole number). The later is item node of rights. If later is less than 0, set item node of rights to newspot, return. Attach from later with key.\n\nAttach from 0 with key. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Show item node of values. The left is item node of lefts. The right is item node of rights. If left is at least 0, Place left into queue, add 1 to count. If right is at least 0, Place right into queue, add 1 to count.\n","expected":"4\n2\n7\n1\n3\n5\n","step_budget":2000000},{"id":704,"slug":"binary-search","title":"Binary Search","difficulty":"Easy","category":"Array","code":"The numbers is a list of -1, 0, 3, 5, 9, and 12. The target is 9. The low is 0. The high is the last position of numbers. The answer is -1.\nRepeat while low is at most high and answer is -1.\nThe middle is the midpoint of low and high. If item middle of numbers is target, set answer to middle. If item middle of numbers is less than target, set low to middle plus 1. If item middle of numbers is more than target, set high to middle minus 1.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":709,"slug":"to-lower-case","title":"To Lower Case","difficulty":"Easy","category":"String","code":"Keep a shared word as empty text. Place \"Hello\" into word. Keep a shared smalls as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into smalls. Keep a shared result as empty text. The last is the last position of word.\nFor every spot from 0 to last.\nThe symbol is the slice of word from spot to spot plus 1. The code is character 0 of symbol. The lowcap is character 0 of \"A\". The highcap is character 0 of \"Z\". The mapped is symbol. If code is at least lowcap and code is at most highcap, The offset is code minus lowcap, The lowerpiece is the slice of smalls from offset to offset plus 1, set mapped to lowerpiece. Place mapped into result.\n\nShow result.\n","expected":"hello\n","step_budget":2000000},{"id":710,"slug":"random-pick-with-blacklist","title":"Random Pick with Blacklist","difficulty":"Hard","category":"Array","code":"Keep a shared size of 5. Keep a shared blocked as an empty list of whole numbers. Place 1 into blocked. Keep a shared spare of 0. The lastblock is the last position of blocked. The blockedcount is lastblock plus 1. The allowed is size minus blockedcount. The mapping is a list of allowed zeros.\n\nTo seek from start (a whole number). If start is at least size, set spare to start, return. If blocked contains start, Seek from start plus 1, return. Set spare to start.\n\nFor every spot from 0 to lastblock.\nThe value is item spot of blocked. If value is less than allowed, Seek from allowed, Set item value of mapping to spare.\n\nThe seed is 2026.\nFor every pick from 0 to allowed minus 1.\nSet seed to seed times 1103515245 plus 12345. Set seed to seed modulo 2147483648. The draw is seed modulo allowed. The chosen is item draw of mapping. If chosen is 0, set chosen to draw. Show chosen.\n","expected":"3\n0\n4\n2\n","step_budget":2000000},{"id":712,"slug":"minimum-ascii-delete-sum-for-two-strings","title":"Minimum ASCII Delete Sum for Two Strings","difficulty":"Medium","category":"String","code":"The first is \"sea\". The second is \"eat\". The firstsize is the number of characters in first. The secondsize is the number of characters in second. The width is secondsize plus 1. The size is (firstsize plus 1) times width. The table is a list of size zeros.\nFor every firstprefix from 1 to firstsize.\nThe cost is character (firstprefix minus 1) of first. Set item (firstprefix times width) of table to item ((firstprefix minus 1) times width) of table plus cost.\n\nFor every secondprefix from 1 to secondsize.\nThe cost is character (secondprefix minus 1) of second. Set item secondprefix of table to item (secondprefix minus 1) of table plus cost.\n\nFor every firstprefix from 1 to firstsize.\nFor every secondprefix from 1 to secondsize.\nThe index is firstprefix times width plus secondprefix. The leftcost is character (firstprefix minus 1) of first. The rightcost is character (secondprefix minus 1) of second. The removal is item (index minus width) of table plus leftcost. The insertion is item (index minus 1) of table plus rightcost. The best is the smaller of removal and insertion. If character (firstprefix minus 1) of first is character (secondprefix minus 1) of second, set item index of table to item (index minus width minus 1) of table. Otherwise, set item index of table to best.\n\nThe last is one less than size. Show item last of table.\n","expected":"231\n","step_budget":2000000},{"id":713,"slug":"subarray-product-less-than-k","title":"Subarray Product Less Than K","difficulty":"Medium","category":"Array","code":"The numbers is a list of 10, 5, 2, and 6. The limit is 100. The left is 0. The product is 1. The count is 0.\nFor every right from 0 to the last position of numbers.\nSet product to product times item right of numbers. Repeat while left is at most right and product is at least limit, Set product to product divided by item left of numbers, Add 1 to left. Increase count by right minus left plus 1.\n\nShow count.\n","expected":"8\n","step_budget":2000000},{"id":714,"slug":"best-time-to-buy-and-sell-stock-with-transaction-fee","title":"Best Time to Buy and Sell Stock with Transaction Fee","difficulty":"Medium","category":"Array","code":"The prices is a list of 1, 3, 2, 8, 4, and 9. The fee is 2. The cash is 0. The hold is 0 minus item 0 of prices.\nFor every spot from 1 to the last position of prices.\nThe price is item spot of prices. The sell is hold plus price minus fee. If sell is more than cash, set cash to sell. The buy is cash minus price. If buy is more than hold, set hold to buy.\n\nShow cash.\n","expected":"8\n","step_budget":2000000},{"id":717,"slug":"1-bit-and-2-bit-characters","title":"1-bit and 2-bit Characters","difficulty":"Easy","category":"Array","code":"The bits is a list of 1, 0, and 0. The last is the last position of bits. The spot is 0.\nRepeat while spot is less than last.\nIf item spot of bits is 1, add 2 to spot, otherwise add 1 to spot.\n\nIf spot is last, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":718,"slug":"maximum-length-of-repeated-subarray","title":"Maximum Length of Repeated Subarray","difficulty":"Medium","category":"Array","code":"The first is a list of 1, 2, 3, 2, and 1. The second is a list of 3, 2, 1, 4, and 7. The rowsend is the last position of first. The columnsend is the last position of second. The rows is rowsend plus 1. The columns is columnsend plus 1. The width is columns plus 1. The size is (rows plus 1) times width. The table is a list of size zeros. The best is 0.\nFor every firstspot from 1 to rows.\nFor every secondspot from 1 to columns.\nThe index is firstspot times width plus secondspot. If item (firstspot minus 1) of first is item (secondspot minus 1) of second, set item index of table to item (index minus width minus 1) of table plus 1. If item index of table is more than best, set best to item index of table.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":719,"slug":"find-k-th-smallest-pair-distance","title":"Find K-th Smallest Pair Distance","difficulty":"Hard","category":"Array","code":"Keep a shared numbers holding 1, 3, and 1. Keep a shared wanted of 1. Keep a shared finish of 0. Keep a shared bottom of 0. Keep a shared top of 0. Keep a shared answer of 0. Keep a shared tally of 0. Keep a shared front of 0. Sort numbers. Set finish to the last position of numbers. The endpoint is finish. Set top to item endpoint of numbers minus item 0 of numbers. Set answer to top.\n\nTo retreat from right (a whole number) with middle (a whole number). The spot is front. If item right of numbers minus item spot of numbers is at most middle, return. Add 1 to front. Retreat from right with middle.\n\nTo measure from middle (a whole number). Set tally to 0. Set front to 0.\nFor every right from 0 to finish.\nRetreat from right with middle. Increase tally by right minus front.\n\nRepeat while bottom is at most top.\nThe middle is the midpoint of bottom and top. Measure from middle. If tally is at least wanted, set answer to middle, set top to middle minus 1. If tally is less than wanted, set bottom to middle plus 1.\n\nShow answer.\n","expected":"0\n","step_budget":2000000},{"id":720,"slug":"longest-word-in-dictionary","title":"Longest Word in Dictionary","difficulty":"Medium","category":"Array","code":"Keep a shared words holding \"w\", \"wo\", \"wor\", \"worl\", and \"world\". Keep a shared best as empty text. Keep a shared sought as empty text. Keep a shared valid of 0. Keep a shared found of 0.\n\nTo locate from spot (a whole number). If spot is more than the last position of words, return. If item spot of words matches sought, set found to 1, return. Locate from spot plus 1.\n\nTo check from index (a whole number). The word is item index of words. The last is the last position of word. Set valid to 1.\nFor every spot from 0 to last minus 1.\nThe prefix is the slice of word from 0 to spot plus 1. Set sought to prefix. Set found to 0. Locate from 0. If found is 0, set valid to 0.\n\nFor every index from 0 to the last position of words.\nThe word is item index of words. The last is the last position of word. Check from index.\nIf valid is 1.\nThe bestlast is the last position of best. If last is more than bestlast, set best to word. If last is bestlast, If word comes before best, set best to word.\n\nShow best.\n","expected":"world\n","step_budget":2000000},{"id":721,"slug":"accounts-merge","title":"Accounts Merge","difficulty":"Medium","category":"Array","code":"Keep a shared people holding \"John\", \"John\", \"Mary\", and \"John\". Keep a shared emails holding \"johnsmith@mail.com\", \"john_newyork@mail.com\", \"johnsmith@mail.com\", \"john00@mail.com\", \"mary@mail.com\", and \"johnnybravo@mail.com\". Keep a shared starts holding 0, 2, 4, 5, and 6. Keep a shared parents holding 0, 1, 2, and 3. Keep a shared rootresult of 0. Keep a shared sharedfound of 0. Keep a shared gathered as an empty list of text. Keep a shared merged as empty text. Keep a shared candidate as empty text. Keep a shared found of 0.\n\nTo root from node (a whole number). If item node of parents is node, set rootresult to node, return. Root from item node of parents.\n\nTo merge from first (a whole number) with second (a whole number). Root from first. The firstroot is rootresult. Root from second. The secondroot is rootresult. If firstroot is not secondroot, set item firstroot of parents to secondroot.\n\nTo share from first (a whole number) with second (a whole number). Set sharedfound to 0.\nFor every left from item first of starts to item (first plus 1) of starts minus 1.\nFor every right from item second of starts to item (second plus 1) of starts minus 1.\nIf item left of emails matches item right of emails, set sharedfound to 1.\n\nTo locate from spot (a whole number). If spot is more than the last position of gathered, return. If item spot of gathered matches candidate, set found to 1, return. Locate from spot plus 1.\n\nTo gather from person (a whole number) with root (a whole number). Root from person. If rootresult is not root, return.\nFor every spot from item person of starts to item (person plus 1) of starts minus 1.\nSet candidate to item spot of emails. Set found to 0. Locate from 0. If found is 0, Place candidate into gathered.\n\nTo order. The total is the number of items in gathered. The final is total minus 1.\nFor every left from 0 to final.\nFor every right from left plus 1 to final.\nIf item right of gathered comes before item left of gathered, swap item left of gathered and item right of gathered.\n\nTo attach from spot (a whole number). If spot is more than the last position of gathered, return. Place \",\" into merged. Place item spot of gathered into merged. Attach from spot plus 1.\n\nTo wipe. The count is the number of items in gathered. If count is 0, return. Remove the last item from gathered. Wipe.\n\nTo render from person (a whole number) with root (a whole number). Wipe. For every member from 0 to the last position of people, Gather from member with root. Order. The source is item person of people. Set merged to a copy of source. Attach from 0. Show merged.\n\nFor every left from 0 to the last position of people.\nFor every right from left plus 1 to the last position of people.\nShare from left with right. If sharedfound is 1, merge from left with right.\n\nFor every person from 0 to the last position of people.\nRoot from person. If rootresult is person, Render from person with person.\n","expected":"John,john00@mail.com,john_newyork@mail.com,johnsmith@mail.com\nMary,mary@mail.com\nJohn,johnnybravo@mail.com\n","step_budget":2000000},{"id":722,"slug":"remove-comments","title":"Remove Comments","difficulty":"Medium","category":"Array","code":"Keep a shared source holding \"/*Test program */\", \"int main()\", \"{ \", \"  // variable declaration \", \"int a, b, c;\", \"/* This is a test\", \"   multiline  \", \"   comment for \", \"   testing */\", \"a = b + c;\", and \"}\". Keep a shared current as empty text. Keep a shared answers as an empty list of text. Keep a shared newline as empty text. Place \"\\n\" into newline.\n\nTo flush. The size is the number of characters in current. If size is more than 0, Place current into answers. Set current to empty text.\n\nThe joined is join source with newline. The last is the last position of joined. The inblock is 0. The silent is 0. The spot is 0.\nRepeat while spot is at most last.\nThe symbol is the slice of joined from spot to spot plus 1. The pair is symbol. If spot is less than last, set pair to the slice of joined from spot to spot plus 2. The opening is 0. The closing is 0. The notice is 0. The newlinehere is 0. If pair matches \"/*\", set opening to 1. If pair matches \"*/\", set closing to 1. If pair matches \"//\", set notice to 1. If symbol matches newline, set newlinehere to 1. The used is 1. If inblock is 1 and closing is 1, set inblock to 0, set used to 2. If inblock is 0 and newlinehere is 1, Flush, set silent to 0. If inblock is 0 and newlinehere is 0 and silent is 1, set used to 1. If inblock is 0 and newlinehere is 0 and silent is 0 and opening is 1, set inblock to 1, set used to 2. If inblock is 0 and newlinehere is 0 and silent is 0 and notice is 1, set silent to 1, set used to 2. If inblock is 0 and newlinehere is 0 and silent is 0 and opening is 0 and notice is 0 and used is 1, Place symbol into current. Increase spot by used.\n\nFlush. For each answer in answers, show answer.\n","expected":"int main()\n{ \n  \nint a, b, c;\na = b + c;\n}\n","step_budget":17368400},{"id":724,"slug":"find-pivot-index","title":"Find Pivot Index","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 7, 3, 6, 5, and 6. The whole is 0.\nFor each value in numbers.\nAdd value to whole.\n\nThe left is 0. The answer is -1.\nFor every spot from 0 to the last position of numbers.\nThe rest is whole minus left minus item spot of numbers. If left is rest and answer is -1, set answer to spot. Increase left by item spot of numbers.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":725,"slug":"split-linked-list-in-parts","title":"Split Linked List in Parts","difficulty":"Medium","category":"Linked List","code":"Keep a shared values holding 1, 2, and 3. Keep a shared width of 0. Keep a shared spot of 0. Keep a shared line as empty text. The parts is 5. The last is the last position of values. The size is last plus 1. The base is size divided by parts. The extra is size modulo parts.\n\nTo pack from start (a whole number) with count (a whole number). Place \"[\" into line.\nFor every step from start to start plus count minus 1.\nIf step is more than start, Place \", \" into line. The piece is format whole number item step of values as text. Place piece into line.\n\nFor every part from 0 to parts minus 1.\nSet width to base. If part is less than extra, add 1 to width. Set line to empty text. Pack from spot with width. Place \"]\" into line. Increase spot by width. Show line.\n","expected":"[1]\n[2]\n[3]\n[]\n[]\n","step_budget":2000000},{"id":726,"slug":"number-of-atoms","title":"Number of Atoms","difficulty":"Hard","category":"String","code":"Keep a shared formula as empty text. Place \"K4(ON(SO3)2)2\" into formula. Keep a shared flatnames as an empty list of text. Keep a shared flatcounts as an empty list of whole numbers. Keep a shared flatvalid as an empty list of whole numbers. Keep a shared finalnames as an empty list of text. Keep a shared finalcounts as an empty list of whole numbers. Keep a shared scanspot of 0. Keep a shared limit of 0. Keep a shared parsename as empty text. Keep a shared parsecount of 0. Keep a shared mergename as empty text. Keep a shared foundspot of 0. Keep a shared multiplier of 0. Keep a shared parentstart of 0.\nTo findentry from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The okay is item spot of flatvalid. The same is 0. If item spot of flatnames matches mergename, set same to 1. If okay is 1 and same is 1, set foundspot to spot, return. Findentry from spot plus 1 with finish.\n\nTo store with base (a whole number) and amount (a whole number). Set mergename to empty text. Place parsename into mergename. Set foundspot to -1. The finish is the last position of flatnames. Findentry from base with finish. The placefound is foundspot. If placefound is at least 0, set item placefound of flatcounts to item placefound of flatcounts plus amount. If placefound is at least 0, return. Place parsename into flatnames. Place amount into flatcounts. Place 1 into flatvalid.\n\nTo readlower. If scanspot is more than limit, return. The piece is the slice of formula from scanspot to scanspot plus 1. The spot is scanspot. The symbol is character spot of formula.\nIf symbol is between \"a\" and \"z\".\nPlace piece into parsename. Add 1 to scanspot. Readlower.\n\nTo readcount. If scanspot is more than limit, return. The piece is the slice of formula from scanspot to scanspot plus 1. The spot is scanspot. The symbol is character spot of formula.\nIf symbol is between \"0\" and \"9\".\nThe digit is the digit value of symbol. Set parsecount to parsecount times 10 plus digit. Add 1 to scanspot. Readcount.\n\nTo readelement from base (a whole number). Set parsename to empty text. The piece is the slice of formula from scanspot to scanspot plus 1. Place piece into parsename. Add 1 to scanspot. Readlower. Set parsecount to 0. Readcount. If parsecount is 0, set parsecount to 1. Store with base and parsecount. Readgroup from base.\n\nTo readmultiplier. If scanspot is more than limit, return. The piece is the slice of formula from scanspot to scanspot plus 1. The spot is scanspot. The symbol is character spot of formula.\nIf symbol is between \"0\" and \"9\".\nThe digit is the digit value of symbol. Set multiplier to multiplier times 10 plus digit. Add 1 to scanspot. Readmultiplier.\n\nTo skipclose. The piece is the slice of formula from scanspot to scanspot plus 1. If piece matches \")\", add 1 to scanspot.\n\nTo multiplyrange from spot (a whole number) with finish (a whole number). If spot is more than finish, return. If item spot of flatvalid is 1, set item spot of flatcounts to item spot of flatcounts times multiplier. Multiplyrange from spot plus 1 with finish.\n\nTo mergeone from spot (a whole number). The name is item spot of flatnames. Set mergename to empty text. Place name into mergename. Set foundspot to -1. Findentry from parentstart with spot minus 1. The placefound is foundspot. If placefound is at least 0, set item placefound of flatcounts to item placefound of flatcounts plus item spot of flatcounts. If foundspot is less than 0, Place mergename into flatnames, Place item spot of flatcounts into flatcounts, Place 1 into flatvalid.\n\nTo mergerange from spot (a whole number) with finish (a whole number). If spot is more than finish, return. If item spot of flatvalid is 1, mergeone from spot. Mergerange from spot plus 1 with finish.\n\nTo readgroup from base (a whole number). If scanspot is more than limit, return. The piece is the slice of formula from scanspot to scanspot plus 1. If piece matches \")\", return. If piece matches \"(\", readgroupbody from base, return. Readelement from base.\n\nTo readgroupbody from base (a whole number). Add 1 to scanspot. The top is the last position of flatnames. The childstart is top plus 1. Readgroup from childstart. Finishgroup with base and childstart.\n\nTo invalidate from spot (a whole number) with finish (a whole number). If spot is more than finish, return. Set item spot of flatvalid to 0. Invalidate from spot plus 1 with finish.\n\nTo finishgroup with base (a whole number) and childstart (a whole number). If scanspot is at most limit, skipclose. Set multiplier to 0. Readmultiplier. If multiplier is 0, set multiplier to 1. The childend is the last position of flatnames. Multiplyrange from childstart with childend. Set parentstart to base. Mergerange from childstart with childend. Invalidate from childstart with childend. Readgroup from base.\n\nSet limit to the last position of formula. Readgroup from 0. The last is the last position of flatnames.\nFor every spot from 0 to last.\nThe okay is item spot of flatvalid.\nIf okay is 1.\nThe name is item spot of flatnames. The amount is item spot of flatcounts. Place name into finalnames. Place amount into finalcounts.\n\nThe finallast is the last position of finalnames.\nFor every left from 0 to finallast.\nFor every right from left plus 1 to finallast.\nIf item right of finalnames comes before item left of finalnames.\nSwap item left of finalnames and item right of finalnames. Swap item left of finalcounts and item right of finalcounts.\n\nThe result is empty text.\nFor every spot from 0 to finallast.\nThe name is item spot of finalnames. The amount is item spot of finalcounts. Place name into result.\nIf amount is more than 1.\nPlace format whole number amount as text into result.\n\nShow result.\n","expected":"K4N2O14S4\n","step_budget":2000000},{"id":728,"slug":"self-dividing-numbers","title":"Self Dividing Numbers","difficulty":"Easy","category":"Math","code":"The left is 1. The right is 22. Keep a shared quality of 1.\nTo check with value (a whole number) and original (a whole number). If value is 0, return. If quality is 0, return. The digit is value modulo 10. If digit is 0, set quality to 0, return. If original modulo digit is not 0, set quality to 0, return. Check with value divided by 10 and original.\n\nThe answers is an empty list of whole numbers.\nFor every number from left to right.\nSet quality to 1. Check with number and number. If quality is 1, Place number into answers.\n\nThe line is empty text.\nFor each answer in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number answer as text into line.\n\nShow line.\n","expected":"1,2,3,4,5,6,7,8,9,11,12,15,22\n","step_budget":2000000},{"id":730,"slug":"count-different-palindromic-subsequences","title":"Count Different Palindromic Subsequences","difficulty":"Hard","category":"String","code":"Keep a shared word as empty text. Place \"bccb\" into word. Keep a shared size of 4. Keep a shared modulus of 1000000007. Keep a shared table as an empty list of whole numbers.\nFor every spot from 0 to 15.\nPlace 0 into table.\n\nKeep a shared firstspot of 0. Keep a shared lastspot of 0.\nTo findfirst from spot (a whole number) with finish (a whole number) and target (a whole number). If spot is at least finish, return. The here is character spot of word. If here is target, set firstspot to spot, return. Findfirst from spot plus 1 with finish and target.\n\nTo findlast from spot (a whole number) with finish (a whole number) and target (a whole number). If spot is less than finish, return. The here is character spot of word. If here is target, set lastspot to spot, return. Findlast from spot minus 1 with finish and target.\n\nTo fold from start (a whole number) with span (a whole number) and width (a whole number). The finish is start plus span minus 1. The next is start plus 1. The before is finish minus 1. The inside is item (next times width plus finish) of table. The below is item (start times width plus before) of table. The overlap is item (next times width plus before) of table. The value is inside plus below minus overlap. Set value to value modulo modulus. If value is less than 0, set value to value plus modulus. Set item (start times width plus finish) of table to value.\n\nTo match from start (a whole number) with span (a whole number) and width (a whole number). The finish is start plus span minus 1. If span is 2, set item (start times width plus finish) of table to 2, return. The next is start plus 1. The before is finish minus 1. The inside is item (next times width plus before) of table. The value is inside times 2. Set firstspot to -1. Set lastspot to -2. The target is character start of word. Findfirst from next with finish and target. Findlast from before with next and target. If firstspot is less than 0, set value to value plus 2. If firstspot is at least 0 and firstspot is lastspot, set value to value plus 1. The leftcut is firstspot plus 1. The rightcut is lastspot minus 1. If firstspot is at least 0 and firstspot is not lastspot, set value to value minus item (leftcut times width plus rightcut) of table. Set value to value modulo modulus. If value is less than 0, set value to value plus modulus. Set item (start times width plus finish) of table to value.\n\nFor every spot from 0 to 3.\nSet item (spot times 4 plus spot) of table to 1.\n\nFor every span from 2 to 4.\nFor every start from 0 to 4 minus span.\nThe finish is start plus span minus 1. The firstchar is character start of word. The lastchar is character finish of word. If firstchar is not lastchar, Fold from start with span and size. If firstchar is lastchar, Match from start with span and size.\n\nThe last is size minus 1. Show item last of table.\n","expected":"6\n","step_budget":2000000},{"id":733,"slug":"flood-fill","title":"Flood Fill","difficulty":"Easy","category":"Array","code":"Keep a shared image holding 1, 1, 1, 1, 1, 0, 1, 0, and 1. Keep a shared rows of 3. Keep a shared columns of 3. Keep a shared old of 0. The start is 4. Set old to item start of image. Keep a shared color of 2. Keep a shared queue as an empty list of whole numbers. Keep a shared count of 0. Keep a shared front of 0.\nTo expand from node (a whole number). The row is node divided by columns. The column is node modulo columns. The up is node minus columns. The down is node plus columns. The left is node minus 1. The right is node plus 1. If row is more than 0 and item up of image is old, set item up of image to color, Place up into queue, add 1 to count. If row is less than rows minus 1 and item down of image is old, set item down of image to color, Place down into queue, add 1 to count. If column is more than 0 and item left of image is old, set item left of image to color, Place left into queue, add 1 to count. If column is less than columns minus 1 and item right of image is old, set item right of image to color, Place right into queue, add 1 to count.\n\nIf old is not color.\nSet item start of image to color. Place start into queue. Set count to 1.\n\nRepeat while front is less than count.\nThe spot is front. The node is item spot of queue. Add 1 to front. Expand from node.\n\nFor each value in image, show value.\n","expected":"2\n2\n2\n2\n2\n0\n2\n0\n1\n","step_budget":2000000},{"id":735,"slug":"asteroid-collision","title":"Asteroid Collision","difficulty":"Medium","category":"Array","code":"The rocks is a list of 5, 10, and -5. The last is the last position of rocks. The stack is an empty list of whole numbers.\nFor each rock in rocks.\nIf rock is more than 0, Place rock into stack.\nIf rock is less than 0.\nThe alive is 1.\nRepeat while alive is 1.\nThe end is the last position of stack. If end is less than 0, Place rock into stack, set alive to 0, stop. The top is item end of stack. If top is less than 0, Place rock into stack, set alive to 0, stop. The size is 0 minus rock. If top is less than size, remove the last item from stack. If top is more than size, set alive to 0, stop. If top is size, remove the last item from stack, set alive to 0, stop.\n\nThe line is empty text.\nFor each rock in stack.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number rock as text into line.\n\nShow line.\n","expected":"5,10\n","step_budget":2000000},{"id":736,"slug":"parse-lisp-expression","title":"Parse Lisp Expression","difficulty":"Hard","category":"String","code":"Keep a shared tokens as an empty list of text. Keep a shared token as empty text. Keep a shared nextspot of 0. Keep a shared atom as empty text. Keep a shared wanted as empty text. Keep a shared parsevalue of 0. Keep a shared numbervalue of 0. Keep a shared lookupvalue of 0. Keep a shared depth of 0. Keep a shared groupclose of 0. Keep a shared names as an empty list of text. Keep a shared values as an empty list of whole numbers.\nTo flush. If the length of token is more than 0, Place token into tokens, set token to empty text.\n\nTo seekclose from spot (a whole number). If spot is more than the last position of tokens, return. The piece is item spot of tokens. If piece matches \"(\", add 1 to depth. If piece matches \")\", subtract 1 from depth. If depth is 0, set groupclose to spot, return. Seekclose from spot plus 1.\n\nTo shrink from base (a whole number). If the last position of names is less than base, return. remove the last item from names. remove the last item from values. Shrink from base.\n\nTo lookup from spot (a whole number). If spot is less than 0, return. If item spot of names matches wanted, set lookupvalue to item spot of values, return. Lookup from spot minus 1.\n\nTo numbervalue from spot (a whole number). If spot is more than the last position of atom, return. The letter is character spot of atom. The digit is the digit value of letter. Set numbervalue to numbervalue times 10 plus digit. Numbervalue from spot plus 1.\n\nTo parsenumber. Set numbervalue to 0. Numbervalue from 0. Set parsevalue to numbervalue. Add 1 to nextspot.\n\nTo parse. The spot is nextspot. Set atom to item spot of tokens. If atom matches \"(\", parselist, return. If atom matches \")\", return. The firstchar is character 0 of atom. If firstchar is between \"0\" and \"9\", parsenumber, return. Set wanted to atom. The top is the last position of names. Lookup from top. Set parsevalue to lookupvalue. Add 1 to nextspot.\n\nTo parselist. Add 1 to nextspot. The spot is nextspot. The operator is item spot of tokens. Add 1 to nextspot. If operator matches \"add\", parseadd, return. If operator matches \"mult\", parsemult, return. If operator matches \"let\", parselet, return.\n\nTo parseadd. Parse. The first is parsevalue. Parse. The second is parsevalue. Add 1 to nextspot. Set parsevalue to first plus second.\n\nTo parsemult. Parse. The first is parsevalue. Parse. The second is parsevalue. Add 1 to nextspot. Set parsevalue to first times second.\n\nTo parselet. Set depth to 0. The open is nextspot minus 2. Seekclose from open. The top is the last position of names. The base is top plus 1. The finish is groupclose. Letpairs with base and finish.\n\nTo finishlet with base (a whole number). Parse. Shrink from base.\n\nTo letpairs with base (a whole number) and finish (a whole number). The spot is nextspot. The atom is item spot of tokens. If atom matches \"(\", Finishlet with base, return. If nextspot plus 1 is finish, Finishlet with base, return. The name is atom. Add 1 to nextspot. Parse. Place name into names. Place parsevalue into values. Letpairs with base and finish.\n\nThe expression is \"(let x 2 (mult x (let x 3 y 4 (add x y))))\". The last is the last position of expression.\nFor every spot from 0 to last.\nThe symbol is the slice of expression from spot to spot plus 1. The special is 0. The brace is 0. If symbol matches \"(\", set brace to 1, set special to 1. If symbol matches \")\", set brace to 1, set special to 1. If symbol matches \" \", set special to 1. If special is 1, Flush. If special is 0, Place symbol into token. If brace is 1, Place symbol into tokens.\n\nFlush. Set nextspot to 0. Parse. Show parsevalue.\n","expected":"14\n","step_budget":2708090},{"id":738,"slug":"monotone-increasing-digits","title":"Monotone Increasing Digits","difficulty":"Medium","category":"Math","code":"The value is 332. The rest is value. The digits is an empty list of whole numbers.\nRepeat while rest is more than 0.\nPlace rest modulo 10 into digits. Set rest to rest divided by 10.\n\nThe last is the last position of digits. Keep a shared ordered as an empty list of whole numbers.\nFor every spot from 0 to last.\nThe source is last minus spot. Place item source of digits into ordered.\n\nKeep a shared cut of 0.\nTo repair from spot (a whole number). If spot is less than 0, return.\nIf item spot of ordered is more than item (spot plus 1) of ordered.\nDecrease item spot of ordered by 1. Set cut to spot plus 1. Repair from spot minus 1.\n\nSet cut to last plus 1. Repair from last minus 1. The result is 0.\nFor every spot from 0 to last.\nThe digit is item spot of ordered. If spot is at least cut, set digit to 9. Set result to result times 10 plus digit.\n\nShow result.\n","expected":"299\n","step_budget":2000000},{"id":739,"slug":"daily-temperatures","title":"Daily Temperatures","difficulty":"Medium","category":"Array","code":"The temperatures is a list of 73, 74, 75, 71, 69, 72, 76, and 73. The last is the last position of temperatures. The wait is a list of 8 zeros. The stack is an empty list of whole numbers.\nFor every day from 0 to last.\nThe settled is 0.\nRepeat while settled is 0.\nThe end is the last position of stack. If end is less than 0, Place day into stack, set settled to 1, stop. The top is item end of stack. If item day of temperatures is more than item top of temperatures, remove the last item from stack, set item top of wait to day minus top. If item day of temperatures is at most item top of temperatures, Place day into stack, set settled to 1, stop.\n\nThe line is empty text.\nFor each value in wait.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number value as text into line.\n\nShow line.\n","expected":"1,1,4,2,1,1,0,0\n","step_budget":2000000},{"id":740,"slug":"delete-and-earn","title":"Delete and Earn","difficulty":"Medium","category":"Array","code":"The numbers is a list of 3, 4, 2. The last is the last position of numbers. The largest is 0.\nFor every spot from 0 to last.\nIf item spot of numbers is more than largest, set largest to item spot of numbers.\n\nThe counts is a list of largest plus 1 zeros.\nFor every spot from 0 to last.\nThe value is item spot of numbers. Increase item value of counts by 1.\n\nThe best is a list of largest plus 1 zeros.\nFor every value from 1 to largest.\nThe skip is 0. If value is more than 1, set skip to item (value minus 1) of best. The take is value times item value of counts. If value is more than 1, set take to take plus item (value minus 2) of best. If skip is more than take, set item value of best to skip, otherwise set item value of best to take.\n\nShow item largest of best.\n","expected":"6\n","step_budget":2000000},{"id":741,"slug":"cherry-pickup","title":"Cherry Pickup","difficulty":"Hard","category":"Array","code":"Keep a shared grid holding 0, 1, -1, 1, 0, -1, 1, 1, and 1. Keep a shared table as an empty list of whole numbers.\nFor every spot from 0 to 44.\nPlace -1 into table.\n\nKeep a shared best of 0. Keep a shared stepnow of 0. Keep a shared firstnow of 0. Keep a shared secondnow of 0.\nTo improve from index (a whole number). If index is less than 0, return. If index is at least 45, return. The candidate is item index of table. If candidate is more than best, set best to candidate.\n\nTo walk. The firstcolumn is stepnow minus firstnow. The secondcolumn is stepnow minus secondnow. If firstcolumn is less than 0, return. If firstcolumn is at least 3, return. If secondcolumn is less than 0, return. If secondcolumn is at least 3, return. The firstcell is item (firstnow times 3 plus firstcolumn) of grid. The secondcell is item (secondnow times 3 plus secondcolumn) of grid. If firstcell is -1, return. If secondcell is -1, return. Set best to -1. The base is (stepnow minus 1) times 9. The above is firstnow minus 1. The beside is secondnow minus 1. The topstripe is above times 3. The firststripe is firstnow times 3. The secondstripe is secondnow times 3. The upleft is base plus topstripe plus beside. The upright is base plus firststripe plus beside. The downleft is base plus topstripe plus secondnow. The downright is base plus firststripe plus secondnow. Improve from upleft. Improve from upright. Improve from downleft. Improve from downright. If best is less than 0, return. The gain is firstcell. If firstnow is not secondnow, set gain to gain plus secondcell. The slot is stepnow times 9. The spot is slot plus firststripe plus secondnow. Set item spot of table to best plus gain.\n\nIf item 0 of grid is not -1, set item 0 of table to item 0 of grid.\nFor every step from 1 to 4.\nFor every firstrow from 0 to 2.\nFor every secondrow from 0 to 2.\nSet stepnow to step. Set firstnow to firstrow. Set secondnow to secondrow. Walk.\n\nThe answer is item 44 of table. If answer is less than 0, show 0, otherwise show answer.\n","expected":"5\n","step_budget":2000000},{"id":743,"slug":"network-delay-time","title":"Network Delay Time","difficulty":"Medium","category":"Depth-First Search","code":"The nodes is 4. The large is 1000000. The times is a list of 2, 1, 1, 2, 3, 1, 3, 4, and 1. The graph is an empty list of whole numbers.\nFor every spot from 0 to 15.\nPlace large into graph.\n\nFor every spot from 0 to 3.\nSet item (spot times 4 plus spot) of graph to 0.\n\nFor every pair from 0 to 2.\nThe base is pair times 3. The source is item base of times. The target is item (base plus 1) of times. The weight is item (base plus 2) of times. The slot is source minus 1. The place is target minus 1. The here is item (slot times 4 plus place) of graph. If weight is less than here, set item (slot times 4 plus place) of graph to weight.\n\nFor every middle from 0 to 3.\nFor every start from 0 to 3.\nFor every finish from 0 to 3.\nThe first is item (start times 4 plus middle) of graph. The second is item (middle times 4 plus finish) of graph. The through is first plus second. The direct is item (start times 4 plus finish) of graph. If through is less than direct, set item (start times 4 plus finish) of graph to through.\n\nThe answer is 0.\nFor every spot from 0 to 3.\nThe distance is item (4 plus spot) of graph. If distance is more than answer, set answer to distance.\n\nIf answer is at least large, show -1, otherwise show answer.\n","expected":"2\n","step_budget":2000000},{"id":744,"slug":"find-smallest-letter-greater-than-target","title":"Find Smallest Letter Greater Than Target","difficulty":"Easy","category":"Array","code":"The letters is a list of \"c\", \"f\", and \"j\". The target is \"a\". The last is the last position of letters. The picked is 0.\nFor every spot from 0 to last.\nIf picked is 0.\nIf item spot of letters comes after target.\nShow item spot of letters. Set picked to 1.\n\nIf picked is 0, Show item 0 of letters.\n","expected":"c\n","step_budget":2000000},{"id":746,"slug":"min-cost-climbing-stairs","title":"Min Cost Climbing Stairs","difficulty":"Easy","category":"Array","code":"The costs is a list of 10, 15, and 20. The last is the last position of costs. The best is a list of last plus 2 zeros.\nFor every step from 2 to last plus 1.\nThe first is item (step minus 1) of best plus item (step minus 1) of costs. The second is item (step minus 2) of best plus item (step minus 2) of costs. If first is less than second, set item step of best to first, otherwise set item step of best to second.\n\nShow item (last plus 1) of best.\n","expected":"15\n","step_budget":2000000},{"id":747,"slug":"largest-number-at-least-twice-of-others","title":"Largest Number At Least Twice of Others","difficulty":"Easy","category":"Array","code":"The numbers is a list of 3, 6, 1, and 0. The last is the last position of numbers. The champion is 0. The bestspot is 0.\nFor every spot from 0 to last.\nIf item spot of numbers is more than champion, set champion to item spot of numbers, set bestspot to spot.\n\nThe second is -1.\nFor every spot from 0 to last.\nIf spot is not bestspot and item spot of numbers is more than second, set second to item spot of numbers.\n\nThe doubled is second times 2. If champion is at least doubled and bestspot is not -1, show bestspot, otherwise show -1.\n","expected":"1\n","step_budget":2000000},{"id":748,"slug":"shortest-completing-word","title":"Shortest Completing Word","difficulty":"Easy","category":"Array","code":"The plate is \"1s3 PSt\". The alphabet is \"abcdefghijklmnopqrstuvwxyz\". The capitals is \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\". The base is character 0 of alphabet. The upbase is character 0 of capitals. Keep a shared needed as an empty list of whole numbers.\nFor every letter from 0 to 25.\nPlace 0 into needed.\n\nThe platelast is the last position of plate.\nFor every spot from 0 to platelast.\nThe symbol is character spot of plate. The lower is 0. If symbol is at least base and symbol is at most base plus 25, set lower to symbol. If symbol is at least upbase and symbol is at most upbase plus 25, set lower to symbol plus base minus upbase.\nIf lower is more than 0.\nThe index is lower minus base. Increase item index of needed by 1.\n\nThe words is a list of \"step\", \"steps\", \"stripe\", and \"stepp\". The wordlast is the last position of words. The slots is wordlast plus 1. The size is slots times 26. Keep a shared lettercounts as an empty list of whole numbers.\nFor every spot from 0 to size minus 1.\nPlace 0 into lettercounts.\n\nFor every slot from 0 to wordlast.\nThe word is item slot of words. The letters is the last position of word.\nFor every spot from 0 to letters.\nThe symbol is character spot of word. The index is symbol minus base. Increase item (slot times 26 plus index) of lettercounts by 1.\n\nKeep a shared good of 0.\nTo inspect with slot (a whole number). Set good to 1.\nFor every letter from 0 to 25.\nThe have is item (slot times 26 plus letter) of lettercounts. If have is less than item letter of needed, set good to 0.\n\nThe best is -1. The bestsize is 0.\nFor every slot from 0 to wordlast.\nInspect with slot. The word is item slot of words. The end is the last position of word. The sizeword is end plus 1. If good is 1 and best is -1, set best to slot, set bestsize to sizeword. If good is 1 and best is not -1 and sizeword is less than bestsize, set best to slot, set bestsize to sizeword.\n\nShow item best of words.\n","expected":"steps\n","step_budget":2000000},{"id":749,"slug":"contain-virus","title":"Contain Virus","difficulty":"Hard","category":"Array","code":"Keep a shared grid holding 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, and 0. Keep a shared seen as an empty list of whole numbers.\nFor every spot from 0 to 31.\nPlace 0 into seen.\n\nKeep a shared regioncells as an empty list of whole numbers. Keep a shared regionstart as an empty list of whole numbers. Keep a shared regionwalls as an empty list of whole numbers. Keep a shared threats as an empty list of whole numbers. Keep a shared regionthreatstart as an empty list of whole numbers. Keep a shared currentregion of 0. Keep a shared regioncount of 0. Keep a shared wantedcell of 0. Keep a shared threatfound of 0. Keep a shared rangestart of 0. Keep a shared rangefinish of 0. Keep a shared threatbegin of 0. Keep a shared threatend of 0. Keep a shared bestregion of 0. Keep a shared bestscore of 0. Keep a shared totalwalls of 0. Keep a shared active of 0.\nTo resetseen from spot (a whole number). If spot is more than 31, return. Set item spot of seen to 0. Resetseen from spot plus 1.\n\nTo clearcells. If the last position of regioncells is less than 0, return. remove the last item from regioncells. Clearcells.\n\nTo clearstarts. If the last position of regionstart is less than 0, return. remove the last item from regionstart. Clearstarts.\n\nTo clearwalls. If the last position of regionwalls is less than 0, return. remove the last item from regionwalls. Clearwalls.\n\nTo clearthreats. If the last position of threats is less than 0, return. remove the last item from threats. Clearthreats.\n\nTo clearthreatstarts. If the last position of regionthreatstart is less than 0, return. remove the last item from regionthreatstart. Clearthreatstarts.\n\nTo findthreat from spot (a whole number) with finish (a whole number). If spot is more than finish, return. If item spot of threats is wantedcell, set threatfound to 1, return. Findthreat from spot plus 1 with finish.\n\nTo exploreempty from cell (a whole number). The region is currentregion. Increase item region of regionwalls by 1. Set wantedcell to cell. The start is item region of regionthreatstart. The finish is the last position of threats. Set threatfound to 0. Findthreat from start with finish. If threatfound is 0, Place cell into threats.\n\nTo explore from cell (a whole number). If cell is less than 0, return. If cell is more than 31, return. If item cell of seen is 1, return. If item cell of grid is 2, return. If item cell of grid is 0, exploreempty from cell, return. Set item cell of seen to 1. Place cell into regioncells. The row is cell divided by 8. The column is cell modulo 8. If row is more than 0, explore from cell minus 8. If row is less than 3, explore from cell plus 8. If column is more than 0, explore from cell minus 1. If column is less than 7, explore from cell plus 1.\n\nTo scanone from spot (a whole number). The cellend is the last position of regioncells. The cellstart is cellend plus 1. The threatend is the last position of threats. The threatstart is threatend plus 1. Place cellstart into regionstart. Place threatstart into regionthreatstart. Place 0 into regionwalls. Set currentregion to the last position of regionwalls. Explore from spot.\n\nTo scan from spot (a whole number). If spot is more than 31, return. If item spot of grid is 1 and item spot of seen is 0, scanone from spot. Scan from spot plus 1.\n\nTo choose. Set bestregion to -1. Set bestscore to -1. The lastregion is the last position of regionwalls.\nFor every region from 0 to lastregion.\nThe score is item region of regionwalls. If score is more than bestscore, set bestscore to score, set bestregion to region.\n\nTo bounds with region (a whole number). Set rangestart to item region of regionstart. Set rangefinish to the last position of regioncells.\nIf region is less than regioncount minus 1.\nThe next is region plus 1. The nextstart is item next of regionstart. Set rangefinish to nextstart minus 1.\n\nTo threatbounds with region (a whole number). Set threatbegin to item region of regionthreatstart. Set threatend to the last position of threats.\nIf region is less than regioncount minus 1.\nThe next is region plus 1. The nextstart is item next of regionthreatstart. Set threatend to nextstart minus 1.\n\nTo quarantine from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The cell is item spot of regioncells. Set item cell of grid to 2. Quarantine from spot plus 1 with finish.\n\nTo spreadcells from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The cell is item spot of threats. Set item cell of grid to 1. Spreadcells from spot plus 1 with finish.\n\nTo spread from region (a whole number). If region is more than the last position of regionwalls, return. If region is bestregion, spread from region plus 1, return. Threatbounds with region. Spreadcells from threatbegin with threatend. Spread from region plus 1.\n\nTo apply. The chosen is bestregion. The score is item chosen of regionwalls. Increase totalwalls by score. Bounds with chosen. Quarantine from rangestart with rangefinish. Spread from 0.\n\nTo reset. Resetseen from 0. Clearcells. Clearstarts. Clearwalls. Clearthreats. Clearthreatstarts. Set bestregion to -1.\n\nSet active to 1.\nRepeat while active is 1.\nReset. Scan from 0. The top is the last position of regionwalls. Set regioncount to top plus 1. Choose. If bestregion is less than 0, set active to 0. If bestregion is at least 0, Apply.\n\nShow totalwalls.\n","expected":"10\n","step_budget":2000000},{"id":752,"slug":"open-the-lock","title":"Open the Lock","difficulty":"Medium","category":"Array","code":"Keep a shared blocked as an empty list of whole numbers. Keep a shared distance as an empty list of whole numbers. Keep a shared seen as an empty list of whole numbers. Keep a shared weights as an empty list of whole numbers. Keep a shared digittext as empty text. Keep a shared decoded of 0. Keep a shared queue as an empty list of whole numbers. Keep a shared count of 0. For every cell from 0 to 9999, Place 0 into blocked. For every cell from 0 to 9999, Place 0 into distance. For every cell from 0 to 9999, Place 0 into seen. For every cell from 0 to 9999, Place 0 into queue. Place 1 into weights. Place 10 into weights. Place 100 into weights. Place 1000 into weights.\n\nTo extract from spot (a whole number). If spot is more than 3, return. The symbol is the slice of digittext from spot to spot plus 1. The digit is the digit value of character spot of digittext. Set decoded to decoded times 10 plus digit. Extract from spot plus 1.\n\nTo spread from here (a whole number).\nFor every slot from 0 to 3.\nThe weight is item slot of weights. The digit is (here divided by weight) modulo 10. The higher is digit plus 1. If higher is 10, set higher to 0. The lower is digit minus 1. If lower is less than 0, set lower to 9. The upstate is here plus (higher minus digit) times weight. The downstate is here plus (lower minus digit) times weight. If item upstate of blocked is 0 and item upstate of seen is 0, set item upstate of seen to 1, set item upstate of distance to item here of distance plus 1, Set item count of queue to upstate, add 1 to count. If item downstate of blocked is 0 and item downstate of seen is 0, set item downstate of seen to 1, set item downstate of distance to item here of distance plus 1, Set item count of queue to downstate, add 1 to count.\n\nKeep a shared deadends holding \"0201\", \"0101\", \"0102\", \"1212\", and \"2002\".\nFor each note in deadends.\nSet digittext to note. Set decoded to 0. Extract from 0. The state is decoded. Set item state of blocked to 1.\n\nSet digittext to empty text. Place \"0202\" into digittext. Set decoded to 0. Extract from 0. The goal is decoded. Set item 0 of queue to 0. Set item 0 of seen to 1. The head is 0. Set count to 1. The answer is -1. If item goal of blocked is 1, set answer to -1.\nIf item goal of blocked is 0 and item 0 of blocked is 0.\nRepeat while head is less than count and answer is less than 0.\nThe here is item head of queue. Add 1 to head. If here is goal, set answer to item here of distance. If here is not goal, spread from here.\n\nShow answer.\n","expected":"6\n","step_budget":8179832},{"id":753,"slug":"cracking-the-safe","title":"Cracking the Safe","difficulty":"Hard","category":"String","code":"Keep a shared seen as an empty list of whole numbers. Keep a shared base of 0. Keep a shared span of 0. Keep a shared digits as empty text. Keep a shared result as empty text. Set base to 2. Set span to 1. Place \"0123456789\" into digits. For every slot from 0 to 9999, Place 0 into seen.\nTo explore from node (a whole number).\nFor every digit from 0 to base minus 1.\nThe edge is node times base plus digit.\nIf item edge of seen is 0.\nSet item edge of seen to 1. The nextnode is edge modulo span. Explore from nextnode. The piece is the slice of digits from digit to digit plus 1. Place piece into result.\n\nExplore from 0. Show result.\n","expected":"10\n","step_budget":2000000},{"id":754,"slug":"reach-a-number","title":"Reach a Number","difficulty":"Medium","category":"Math","code":"The target is 3. The distance is the absolute value of target. The total is 0. The steps is 0.\nRepeat while total is less than distance.\nAdd 1 to steps. Add steps to total.\n\nRepeat while (total minus distance) modulo 2 is not 0.\nAdd 1 to steps. Add steps to total.\n\nShow steps.\n","expected":"2\n","step_budget":2000000},{"id":756,"slug":"pyramid-transition-matrix","title":"Pyramid Transition Matrix","difficulty":"Medium","category":"String","code":"Keep a shared current as empty text. Keep a shared nextrow as empty text. Keep a shared patterns as an empty list of text. Keep a shared patternlast of 0. Keep a shared solved of 0. Place \"BCD\" into current. Place \"BCG\" into patterns. Place \"CDE\" into patterns. Place \"GEA\" into patterns. The patternend is the last position of patterns. Set patternlast to patternend.\nTo search. If solved is 1, return. The width is the last position of current. If width is 0, set solved to 1, return. Set nextrow to empty text. Grow from 0.\n\nTo trynext. The width is the last position of current. The extent is the number of characters in nextrow. If extent is not width, return. The parent is a copy of current. The built is a copy of nextrow. Set current to a copy of built. Search. Set current to a copy of parent. Set nextrow to a copy of built.\n\nTo grow from spot (a whole number). If solved is 1, return. The width is the last position of current. The limit is width minus 1. If spot is more than limit, trynext, return. Attempt from spot with 0.\n\nTo attempt from spot (a whole number) with which (a whole number). If solved is 1, return. If which is more than patternlast, return. The pattern is item which of patterns. The left is the slice of current from spot to spot plus 1. The right is the slice of current from spot plus 1 to spot plus 2. The first is the slice of pattern from 0 to 1. The second is the slice of pattern from 1 to 2. The top is the slice of pattern from 2 to 3. If first does not match left, Attempt from spot with which plus 1, return. If second does not match right, Attempt from spot with which plus 1, return. Place top into nextrow. Grow from spot plus 1. remove last character from nextrow. Attempt from spot with which plus 1.\n\nSearch. If solved is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":757,"slug":"set-intersection-size-at-least-two","title":"Set Intersection Size At Least Two","difficulty":"Hard","category":"Array","code":"The starts is a list of 1, 3, and 8. The ends is a list of 3, 7, and 9. The last is the last position of starts.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nIf item right of ends is less than item left of ends, swap item left of ends and item right of ends, swap item left of starts and item right of starts. If item right of ends is item left of ends and item right of starts is more than item left of starts, swap item left of ends and item right of ends, swap item left of starts and item right of starts.\n\nThe chosenlow is -1000000000. The chosenhigh is -1000000000. The total is 0.\nFor every interval from 0 to last.\nThe low is item interval of starts. The high is item interval of ends. If chosenlow is less than low and chosenhigh is at least low, set chosenlow to chosenhigh, set chosenhigh to high, add 1 to total. If chosenhigh is less than low, set chosenlow to high minus 1, set chosenhigh to high, add 2 to total.\n\nShow total.\n","expected":"5\n","step_budget":2000000},{"id":761,"slug":"special-binary-string","title":"Special Binary String","difficulty":"Hard","category":"String","code":"Keep a shared source as empty text. Keep a shared rendered as empty text. Keep a shared closer of 0. Keep a shared capacity of 0. Keep a shared level of 0. Keep a shared used as an empty list of whole numbers. Keep a shared collection as an empty list of text. Place \"11011000\" into source. Set capacity to 32. For every slot from 0 to 31, Place 0 into used.\nFor every slot from 0 to 511.\nPlace \"\" into collection.\n\nTo locate from start (a whole number) with finish (a whole number). The depth is 0. The probe is start. Set closer to finish.\nRepeat while probe is at most finish.\nThe symbol is the slice of source from probe to probe plus 1. If symbol matches \"1\", add 1 to depth. If symbol matches \"0\", set depth to depth minus 1. If depth is 0, set closer to probe, return. Add 1 to probe.\n\nTo arrange with base (a whole number) with count (a whole number). The lastindex is base plus count minus 1.\nFor every left from base to lastindex.\nFor every right from left plus 1 to lastindex, if item left of collection comes before item right of collection, swap item left of collection and item right of collection.\n\nTo finishframe. The base is level times capacity. The spot is level. The count is item spot of used. Arrange with base with count. The built is empty text. Place \"1\" into built. For every slot from base to base plus count minus 1, Place item slot of collection into built. Place \"0\" into built. Set rendered to built.\n\nTo shape from cursor (a whole number) with limit (a whole number). If cursor is more than limit, finishframe, return. Locate from cursor with limit. The childend is closer. Set item (level plus 1) of used to 0. Increase level by 1. Shape from cursor plus 1 with childend minus 1. Decrease level by 1. The child is a copy of rendered. The base is level times capacity. The spot is level. The slot is base plus item spot of used. Set item slot of collection to child. Increase item spot of used by 1. Shape from childend plus 1 with limit.\n\nThe end is the last position of source. Set item 0 of used to 0. Shape from 1 with end minus 1. Show rendered.\n","expected":"11100100\n","step_budget":9121130},{"id":762,"slug":"prime-number-of-set-bits-in-binary-representation","title":"Prime Number of Set Bits in Binary Representation","difficulty":"Easy","category":"Math","code":"Keep a shared current of 0. Keep a shared bits of 0.\nTo tally.\nRepeat while current is more than 0.\nThe low is bitwise and of current and 1. Add low to bits. Set current to shift current right by 1.\n\nThe left is 6. The right is 10. The primes is a list of 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, and 0. The total is 0.\nFor every value from left to right.\nSet current to value. Set bits to 0. Tally. The count is bits. If item count of primes is 1, add 1 to total.\n\nShow total.\n","expected":"4\n","step_budget":2000000},{"id":763,"slug":"partition-labels","title":"Partition Labels","difficulty":"Medium","category":"String","code":"Keep a shared word as empty text. Place \"ababcbacadefegdehijhklij\" into word. Keep a shared last of 0. Keep a shared finish of 0. Keep a shared cursor of 0.\nTo extend.\nRepeat while cursor is at most finish.\nThe symbol is the slice of word from cursor to cursor plus 1. The far is cursor. For every probe from cursor to last, if the slice of word from probe to probe plus 1 matches symbol, set far to probe. If far is more than finish, set finish to far. Add 1 to cursor.\n\nThe end is the last position of word. Set last to end. The answers is an empty list of whole numbers. The begin is 0.\nRepeat while begin is at most last.\nSet finish to begin. Set cursor to begin. Extend. The width is finish minus begin plus 1. Place width into answers. Set begin to finish plus 1.\n\nFor each width in answers, show width.\n","expected":"9\n7\n8\n","step_budget":3724703},{"id":764,"slug":"largest-plus-sign","title":"Largest Plus Sign","difficulty":"Medium","category":"Array","code":"Keep a shared size of 0. Keep a shared cells as an empty list of whole numbers. Keep a shared best of 0. Set size to 5. For every spot from 0 to 24, Place 1 into cells. Set item 22 of cells to 0.\nTo test with center (a whole number). The band is center divided by size. The column is center modulo size. If item center of cells is 0, return. The arm is 0. The open is 1.\nRepeat while open is 1.\nThe reach is arm plus 1. If band is less than reach or band plus reach is at least size or column is less than reach or column plus reach is at least size, set open to 0.\nIf band is at least reach and band plus reach is less than size and column is at least reach and column plus reach is less than size.\nThe above is item ((band minus reach) times size plus column) of cells. The below is item ((band plus reach) times size plus column) of cells. The leftcell is item (band times size plus column minus reach) of cells. The rightcell is item (band times size plus column plus reach) of cells. If above is 1 and below is 1 and leftcell is 1 and rightcell is 1, set arm to reach. If arm is more than best, set best to arm. If above is not 1 or below is not 1 or leftcell is not 1 or rightcell is not 1, set open to 0.\n\nFor every center from 0 to 24.\nTest with center.\n\nThe answer is best plus 1. Show answer.\n","expected":"2\n","step_budget":2000000},{"id":765,"slug":"couples-holding-hands","title":"Couples Holding Hands","difficulty":"Hard","category":"Greedy","code":"Keep a shared seats holding 0, 2, 1, and 3. Keep a shared last of 0. The end is the last position of seats. Set last to end. Keep a shared swaps of 0.\nTo pairseat with seat (a whole number). The first is item seat of seats. The mate is first plus 1. If first modulo 2 is 1, set mate to first minus 1. The second is item (seat plus 1) of seats. If second is mate, return. The found is seat plus 1. For every probe from seat plus 2 to last, if item probe of seats is mate, set found to probe. swap item (seat plus 1) of seats and item found of seats. Add 1 to swaps.\n\nFor every seat from 0 to last by 2.\nPairseat with seat.\n\nShow swaps.\n","expected":"1\n","step_budget":2000000},{"id":766,"slug":"toeplitz-matrix","title":"Toeplitz Matrix","difficulty":"Easy","category":"Array","code":"The cells is a list of 1, 2, 3, 4, 5, 1, 2, 3, 9, 5, 1, and 2. The good is 1.\nFor every band from 0 to 1.\nFor every column from 0 to 2.\nThe here is item (band times 4 plus column) of cells. The below is item ((band plus 1) times 4 plus column plus 1) of cells. If here is not below, set good to 0.\n\nIf good is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":767,"slug":"reorganize-string","title":"Reorganize String","difficulty":"Medium","category":"String","code":"The source is \"aab\". The last is the last position of source. The letters is an empty list of text. The counts is an empty list of whole numbers.\nFor every spot from 0 to last.\nThe symbol is the slice of source from spot to spot plus 1. The found is -1. For every which from 0 to the last position of letters, if item which of letters matches symbol, set found to which. If found is less than 0, Place symbol into letters, Place 1 into counts. If found is at least 0, set item found of counts to item found of counts plus 1.\n\nThe result is empty text. The earlier is empty text. The built is 0. The impossible is 0.\nRepeat while built is less than last plus 1 and impossible is 0.\nThe pick is -1. The best is -1.\nFor every which from 0 to the last position of letters.\nThe amount is item which of counts. The letter is item which of letters. If amount is less than 1, skip to the next one. If letter matches earlier, skip to the next one. If amount is at most best, skip to the next one. Set pick to which. Set best to amount. If pick is less than 0, set impossible to 1. If pick is at least 0, Place item pick of letters into result, set item pick of counts to item pick of counts minus 1, set earlier to item pick of letters, add 1 to built.\n\nIf impossible is 1, Show \"\". If impossible is 0, Show result.\n","expected":"aba\n","step_budget":2000000},{"id":768,"slug":"max-chunks-to-make-sorted-ii","title":"Max Chunks To Make Sorted II","difficulty":"Hard","category":"Array","code":"The numbers is a list of 2, 1, 3, 4, and 4. The last is the last position of numbers. The prefixes is a list of 5 zeros. The suffixes is a list of 5 zeros. Set item 0 of prefixes to item 0 of numbers.\nFor every spot from 1 to last.\nSet item spot of prefixes to item (spot minus 1) of prefixes. If item spot of numbers is more than item spot of prefixes, set item spot of prefixes to item spot of numbers.\n\nSet item last of suffixes to item last of numbers.\nFor every spot from last minus 1 to 0 by -1.\nSet item spot of suffixes to item (spot plus 1) of suffixes. If item spot of numbers is less than item spot of suffixes, set item spot of suffixes to item spot of numbers.\n\nThe chunks is 1. For every split from 0 to last minus 1, if item split of prefixes is at most item (split plus 1) of suffixes, add 1 to chunks. Show chunks.\n","expected":"4\n","step_budget":2000000},{"id":769,"slug":"max-chunks-to-make-sorted","title":"Max Chunks To Make Sorted","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 0, 2, 3, and 4. The last is the last position of numbers. The chunks is 0. The high is 0.\nFor every spot from 0 to last.\nIf item spot of numbers is more than high, set high to item spot of numbers. If high is spot, add 1 to chunks.\n\nShow chunks.\n","expected":"4\n","step_budget":2000000},{"id":770,"slug":"basic-calculator-iv","title":"Basic Calculator IV","difficulty":"Hard","category":"String","code":"Keep a shared token as empty text. Keep a shared parsed of 0. The expression is \"e + 8 - a + 5\". The tokens is split expression by \" \". The constant is 0. The lettercoef is 0. The sign is 1. The last is the last position of tokens.\nTo read from spot (a whole number) with finish (a whole number). If spot is more than finish, return. The digit is the digit value of character spot of token. Set parsed to parsed times 10 plus digit. Read from spot plus 1 with finish.\n\nFor every spot from 0 to last.\nSet token to item spot of tokens. The symbol is character 0 of token. If symbol is \"+\", set sign to 1. If symbol is \"-\", set sign to -1. Set parsed to 0. The finish is the last position of token. If symbol is between \"0\" and \"9\", read from 0 with finish. If symbol is between \"0\" and \"9\", set constant to constant plus sign times parsed. If symbol is \"e\", set constant to constant plus sign. If symbol is \"a\", set lettercoef to lettercoef plus sign.\n\nIf lettercoef is not 0.\nThe lead is format whole number lettercoef as text. Place \"*a\" into lead. Show lead.\n\nShow format whole number constant as text.\n","expected":"-1*a\n14\n","step_budget":2000000},{"id":771,"slug":"jewels-and-stones","title":"Jewels and Stones","difficulty":"Easy","category":"String","code":"The gems is \"aA\". The stones is \"aAAbbbb\". The lastgem is the last position of gems. The laststone is the last position of stones. The total is 0.\nFor every spot from 0 to laststone.\nThe piece is the slice of stones from spot to spot plus 1.\nFor every probe from 0 to lastgem.\nThe jewelpiece is the slice of gems from probe to probe plus 1. If jewelpiece matches piece, add 1 to total.\n\nShow total.\n","expected":"3\n","step_budget":2000000},{"id":773,"slug":"sliding-puzzle","title":"Sliding Puzzle","difficulty":"Hard","category":"Array","code":"Keep a shared board holding 1, 2, 3, 4, 0, and 5. Keep a shared weights holding 117649, 16807, 2401, 343, 49, and 7. Keep a shared queue as an empty list of whole numbers. Keep a shared reached as an empty list of whole numbers. Keep a shared distances as an empty list of whole numbers. Keep a shared head of 0. Keep a shared count of 0. Keep a shared known of 0. Keep a shared blank of 0. For every slot from 0 to 4095, Place 0 into queue.\nTo locate from candidate (a whole number). Set known to -1. For every which from 0 to the last position of reached, if item which of reached is candidate, set known to which, return.\n\nTo findblank from here (a whole number). Set blank to 0.\nFor every spot from 0 to 5.\nThe piece is (here divided by item spot of weights) modulo 7. If piece is 1, set blank to spot.\n\nTo spread from here (a whole number). Findblank from here. The empty is blank. The blankband is empty divided by 3. The blankcolumn is empty modulo 3.\nFor every other from 0 to 5.\nThe otherband is other divided by 3. The othercolumn is other modulo 3. The bandgap is the absolute value of (otherband minus blankband). The columngap is the absolute value of (othercolumn minus blankcolumn).\nIf bandgap plus columngap is 1.\nThe moving is (here divided by item other of weights) modulo 7. The next is here plus (moving minus 1) times item empty of weights plus (1 minus moving) times item other of weights. Locate from next. If known is less than 0, The tail is count, The depth is head, Set item tail of queue to next, Place next into reached, Place (item depth of distances plus 1) into distances, add 1 to count.\n\nThe start is 0. For every spot from 0 to 5, set start to start plus (item spot of board plus 1) times item spot of weights. The goal is 0. For every spot from 0 to 4, set goal to goal plus (spot plus 2) times item spot of weights. Increase goal by item 5 of weights. Set item 0 of queue to start. Place start into reached. Place 0 into distances. Set count to 1. The answer is -1.\nRepeat while head is less than count.\nThe front is head. The here is item front of queue. If here is goal, The progress is head, set answer to item progress of distances, stop. Spread from here. Add 1 to head.\n\nShow answer.\n","expected":"1\n","step_budget":2000000},{"id":775,"slug":"global-and-local-inversions","title":"Global and Local Inversions","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 0, and 2. The last is the last position of numbers. The overall is 0. The nearby is 0.\nFor every first from 0 to last.\nFor every second from first plus 1 to last, if item first of numbers is more than item second of numbers, add 1 to overall.\n\nFor every spot from 0 to last minus 1, if item spot of numbers is more than item (spot plus 1) of numbers, add 1 to nearby.\n\nIf overall is nearby, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":777,"slug":"swap-adjacent-in-lr-string","title":"Swap Adjacent in LR String","difficulty":"Medium","category":"String","code":"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.\n\nTo 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.\n\nTo 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.\n\nTo 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.\n\nCompare from 0 with 0. If verdict is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":778,"slug":"swim-in-rising-water","title":"Swim in Rising Water","difficulty":"Hard","category":"Array","code":"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.\nFor every level from 0 to 3.\nSet 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.\nRepeat while head is less than count and found is 0.\nThe 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.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":779,"slug":"k-th-symbol-in-grammar","title":"K-th Symbol in Grammar","difficulty":"Medium","category":"Math","code":"Keep a shared symbol of 0.\n\nTo 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.\n\nExpand from 4 with 5. Show symbol.\n","expected":"1\n","step_budget":2000000},{"id":780,"slug":"reaching-points","title":"Reaching Points","difficulty":"Hard","category":"Math","code":"The startx is 1, while the starty is 1. The targetx is 3, while the targety is 5. The reachable is 0.\nRepeat while targetx is more than startx and targety is more than starty.\nIf targetx is more than targety, set targetx to targetx modulo targety, otherwise set targety to targety modulo targetx.\n\nIf targetx is startx and targety is at least starty.\nThe gap is targety minus starty. If gap modulo startx is 0, set reachable to 1.\n\nIf targety is starty and targetx is at least startx.\nThe gap is targetx minus startx. If gap modulo starty is 0, set reachable to 1.\n\nIf reachable is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":781,"slug":"rabbits-in-forest","title":"Rabbits in Forest","difficulty":"Medium","category":"Array","code":"The answers is a list of 1, 1, and 2, while the limit is 1000. The counts is a list of 1001 zeros.\nFor each answer in answers.\nIncrease item answer of counts by 1.\n\nThe total is 0.\nFor every spoken from 0 to limit.\nIf item spoken of counts is more than 0.\nThe group is spoken plus 1. The groups is (item spoken of counts plus spoken) divided by group. Add groups times group to total.\n\nShow total.\n","expected":"5\n","step_budget":2000000},{"id":782,"slug":"transform-to-chessboard","title":"Transform to Chessboard","difficulty":"Hard","category":"Array","code":"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.\nFor every row from 0 to 3.\nFor every column from 0 to 3.\nSet 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.\n\nThe rowsum is 0, while the colsum is 0. The rowswap is 0, while the colswap is 0.\nFor every spot from 0 to 3.\nIncrease 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.\n\nThe 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.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":783,"slug":"minimum-distance-between-bst-nodes","title":"Minimum Distance Between BST Nodes","difficulty":"Easy","category":"Depth-First Search","code":"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.\n\nTo 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.\n\nGather from 0. Show best.\n","expected":"1\n","step_budget":2000000},{"id":784,"slug":"letter-case-permutation","title":"Letter Case Permutation","difficulty":"Medium","category":"String","code":"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.\n\nTo 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.\n\nTo 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.\n\nBuild from 0. For each answer in answers, show answer.\n","expected":"a1b2\na1B2\nA1b2\nA1B2\n","step_budget":4087472},{"id":785,"slug":"is-graph-bipartite","title":"Is Graph Bipartite?","difficulty":"Medium","category":"Depth-First Search","code":"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.\nFor every spot from 0 to 3.\nPlace 0 into colors.\n\nKeep 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.\nFor every source from 0 to 3.\nSet 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.\nRepeat while head is less than count and valid is 1.\nThe node is item head of queue. Add 1 to head.\nFor every offset from 0 to item node of counts minus 1.\nThe 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.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":786,"slug":"k-th-smallest-prime-fraction","title":"K-th Smallest Prime Fraction","difficulty":"Medium","category":"Array","code":"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.\nFor every left from 0 to 3.\nFor every right from left plus 1 to 3.\nPlace item left of numbers into numerators. Place item right of numbers into denominators.\n\nThe count is the number of items in numerators. The final is count minus 1.\nFor every pass from 0 to final.\nFor every spot from 0 to count minus 2.\nThe 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.\n\nThe chosen is rank minus 1. Show item chosen of numerators. Show item chosen of denominators.\n","expected":"2\n5\n","step_budget":2000000},{"id":787,"slug":"cheapest-flights-within-k-stops","title":"Cheapest Flights Within K Stops","difficulty":"Medium","category":"Dynamic Programming","code":"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.\n\nTo 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.\n\nFor every round from 1 to stops plus 1.\nSet next to spare. Carry from 0.\nFor every flight from 0 to 4.\nThe 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.\n\nSet answer to item 3 of distance. If answer is at least 1000000, set answer to -1. Show answer.\n","expected":"700\n","step_budget":2000000},{"id":788,"slug":"rotated-digits","title":"Rotated Digits","difficulty":"Medium","category":"Math","code":"The limit is 10. The count is 0.\nFor every number from 1 to limit.\nThe value is number. The good is 0, while the turned is 0. Set good to 1.\nRepeat while value is more than 0.\nThe 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.\n\nShow count.\n","expected":"4\n","step_budget":2000000},{"id":789,"slug":"escape-the-ghosts","title":"Escape The Ghosts","difficulty":"Medium","category":"Array","code":"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.\nFor every ghost from 0 to pairs minus 1.\nThe 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.\n\nIf escape is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":790,"slug":"domino-and-tromino-tiling","title":"Domino and Tromino Tiling","difficulty":"Medium","category":"Dynamic Programming","code":"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.\nFor every step from 3 to steps.\nThe 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.\n\nShow item steps of ways.\n","expected":"5\n","step_budget":2000000},{"id":791,"slug":"custom-sort-string","title":"Custom Sort String","difficulty":"Medium","category":"String","code":"The ranking is \"cba\", while the source is \"abcd\". The result is empty text.\nFor every rank from 0 to 2.\nThe wanted is the slice of ranking from rank to rank plus 1.\nFor every spot from 0 to 3.\nThe here is the slice of source from spot to spot plus 1. If wanted matches here, Place here into result.\n\nFor every spot from 0 to 3.\nThe here is the slice of source from spot to spot plus 1. The present is 0.\nFor every place from 0 to 2.\nThe 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.\n\nShow result.\n","expected":"cbad\n","step_budget":2000000},{"id":792,"slug":"number-of-matching-subsequences","title":"Number of Matching Subsequences","difficulty":"Medium","category":"Array","code":"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.\nFor each word in words.\nThe lastword is the last position of word. The cursor is 0.\nFor every spot from 0 to lastsource.\nIf 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.\n\nShow count.\n","expected":"3\n","step_budget":2000000},{"id":793,"slug":"preimage-size-of-factorial-zeroes-function","title":"Preimage Size of Factorial Zeroes Function","difficulty":"Hard","category":"Math","code":"Keep a shared trail of 0.\n\nTo 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.\n\nThe low is 0, while the high is 20. The aim is 3.\nRepeat while low is less than high.\nThe 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.\n\nSet trail to 0. Tally from low. If trail is aim, show 5, otherwise show 0.\n","expected":"5\n","step_budget":2000000},{"id":794,"slug":"valid-tic-tac-toe-state","title":"Valid Tic-Tac-Toe State","difficulty":"Medium","category":"Array","code":"The board is a list of \"X\", \"O\", \"X\", \"O\", \" \", \"O\", \"X\", \"O\", and \"X\". The squares is a list of 9 zeros.\nFor every spot from 0 to 8.\nThe 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.\n\nThe crosses is 0, while the knots is 0.\nFor every spot from 0 to 8.\nIf item spot of squares is 1, add 1 to crosses. If item spot of squares is 2, add 1 to knots.\n\nThe 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.\n\nIf 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.\n","expected":"true\n","step_budget":2000000},{"id":795,"slug":"number-of-subarrays-with-bounded-maximum","title":"Number of Subarrays with Bounded Maximum","difficulty":"Medium","category":"Array","code":"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.\nFor every start from 0 to last.\nThe best is 0.\nFor every finish from start to last.\nThe 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.\n\nShow count.\n","expected":"3\n","step_budget":2000000},{"id":796,"slug":"rotate-string","title":"Rotate String","difficulty":"Easy","category":"String","code":"The word is \"abcde\", while the goal is \"cdeab\". The size is 5, while the found is 0.\nFor every turn from 0 to 4.\nThe built is empty text. The done is 0.\nFor every spot from 0 to 4.\nThe 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.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":797,"slug":"all-paths-from-source-to-target","title":"All Paths From Source to Target","difficulty":"Medium","category":"Depth-First Search","code":"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.\n\nTo 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.\n\nTo 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.\n\nWalk from 0. For each answer in answers, show answer.\n","expected":"0,1,3\n0,2,3\n","step_budget":2000000},{"id":798,"slug":"smallest-rotation-with-highest-score","title":"Smallest Rotation with Highest Score","difficulty":"Hard","category":"Array","code":"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.\nFor every turn from 0 to 4.\nThe score is 0.\nFor every spot from 0 to 4.\nThe 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.\n\nShow chosen.\n","expected":"3\n","step_budget":2000000},{"id":799,"slug":"champagne-tower","title":"Champagne Tower","difficulty":"Medium","category":"Dynamic Programming","code":"The cups is a list of 6 zeros, while the poured is 2. Set item 0 of cups to 20000.\nFor every row from 0 to 0.\nThe base is (row times (row plus 1)) divided by 2. The below is ((row plus 1) times (row plus 2)) divided by 2.\nFor every glass from 0 to row.\nThe cell is base plus glass. The extra is item cell of cups minus 10000.\nIf extra is more than 0.\nThe 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.\n\nThe 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.\nRepeat while cut is more than 1.\nThe look is cut minus 1. If character look of digits is not \"0\", stop. Subtract 1 from cut.\n\nThe 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.\n","expected":"0.5\n","step_budget":2000000},{"id":801,"slug":"minimum-swaps-to-make-sequences-increasing","title":"Minimum Swaps To Make Sequences Increasing","difficulty":"Hard","category":"Array","code":"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.\nFor every spot from 1 to last.\nSet 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.\n\nIf keepnow is less than swapnow, show keepnow, otherwise show swapnow.\n","expected":"1\n","step_budget":2000000},{"id":802,"slug":"find-eventual-safe-states","title":"Find Eventual Safe States","difficulty":"Medium","category":"Depth-First Search","code":"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.\nFor every node from 0 to 6.\nPlace 0 into colors.\n\nKeep a shared cycle of 0.\nTo 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.\n\nTo 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.\n\nFor every node from 0 to 6.\nSet cycle to 0. If item node of colors is 0, explore from node.\n\nFor every node from 0 to 6.\nIf item node of colors is 2, show node.\n","expected":"2\n4\n5\n6\n","step_budget":2000000},{"id":803,"slug":"bricks-falling-when-hit","title":"Bricks Falling When Hit","difficulty":"Hard","category":"Array","code":"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.\nFor every spot from 0 to 19.\nPlace 0 into reach.\n\nKeep 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.\nTo 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.\n\nTo 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.\n\nTo 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.\n\nTo 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.\n\nFor every turn from 0 to 4.\nThe 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.\n\nFor each amount in results, show amount.\n","expected":"12\n0\n0\n0\n0\n","step_budget":2000000},{"id":804,"slug":"unique-morse-code-words","title":"Unique Morse Code Words","difficulty":"Easy","category":"Array","code":"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.\nTo 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.\n\nTo 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.\n\nTo finish. Set duplicate to 0. Scan from 0. If duplicate is 0, The copy is a copy of rendered, Place copy into seen.\n\nTo 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.\n\nFor each entry in words.\nSet word to entry. Set rendered to empty text. Glue from 0.\n\nReport the number of items in seen.\n","expected":"2\n","step_budget":2000000},{"id":805,"slug":"split-array-with-same-average","title":"Split Array With Same Average","difficulty":"Hard","category":"Array","code":"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.\nTo 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.\n\nPick from 0 with 0 and 0. If possible is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":806,"slug":"number-of-lines-to-write-string","title":"Number of Lines To Write String","difficulty":"Easy","category":"Array","code":"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.\nTo 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.\n\nFor every spot from 0 to the last position of sentence.\nSet 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.\n\nShow sheets. Show used.\n","expected":"3\n60\n","step_budget":4963420},{"id":807,"slug":"max-increase-to-keep-city-skyline","title":"Max Increase to Keep City Skyline","difficulty":"Medium","category":"Array","code":"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.\nFor every row from 0 to size minus 1.\nFor every column from 0 to size minus 1.\nThe 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.\n\nThe total is 0.\nFor every row from 0 to size minus 1.\nFor every column from 0 to size minus 1.\nThe 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.\n\nShow total.\n","expected":"35\n","step_budget":2000000},{"id":808,"slug":"soup-servings","title":"Soup Servings","difficulty":"Medium","category":"Math","code":"The portions is 2. Keep a shared chance as a decimal.\nTo 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.\n\nServe from portions at portions with 1.0. Report chance.\n","expected":"0.6250\n","step_budget":2000000},{"id":809,"slug":"expressive-words","title":"Expressive Words","difficulty":"Medium","category":"Array","code":"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.\nTo 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.\n\nTo 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.\n\nTo 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.\n\nThe total is 0.\nFor each entry in words.\nSet 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.\n\nShow total.\n","expected":"1\n","step_budget":2000000},{"id":810,"slug":"chalkboard-xor-game","title":"Chalkboard XOR Game","difficulty":"Hard","category":"Array","code":"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.\nFor every spot from 0 to last.\nThe mixed is exclusive or of mixed and item spot of numbers.\n\nIf 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.\n","expected":"false\n","step_budget":2000000},{"id":811,"slug":"subdomain-visit-count","title":"Subdomain Visit Count","difficulty":"Medium","category":"Array","code":"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.\nTo 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.\n\nTo 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.\n\nTo close. Gather from 0.\nFor every spot from 0 to the last position of domain.\nIf spot is more than 0 and character spot of domain is \".\", gather from spot plus 1.\n\nTo 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.\n\nFor each entry in visits.\nThe 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.\n\nFor every spot from 0 to the last position of names.\nThe 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.\n","expected":"9001 discuss.leetcode.com\n9001 leetcode.com\n9001 com\n","step_budget":2000000},{"id":812,"slug":"largest-triangle-area","title":"Largest Triangle Area","difficulty":"Easy","category":"Array","code":"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.\nFor every first from 0 to count minus 1.\nFor every second from first plus 1 to count minus 1.\nFor every third from second plus 1 to count minus 1.\nThe 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.\n\nThe area is best as a decimal divided by 2.0. Report area.\n","expected":"2.0000\n","step_budget":2000000},{"id":813,"slug":"largest-sum-of-averages","title":"Largest Sum of Averages","difficulty":"Medium","category":"Array","code":"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.\nFor every spot from 0 to count minus 1.\nThe running is item spot of prefix plus item spot of numbers. Place running into prefix.\n\nKeep a shared table as an empty list of decimals. The size is (groups plus 1) times (count plus 1).\nFor every spot from 0 to size minus 1.\nPlace 0.0 into table.\n\nKeep a shared choice as a decimal.\nTo search from start (a whole number) with group (a whole number). Set choice to -1.0.\nFor every cut from start plus 1 to count minus group plus 1.\nThe 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.\n\nFor every start from 0 to count minus 1.\nThe 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.\n\nFor every group from 2 to groups.\nFor every start from 0 to count minus group.\nSearch from start with group. Set item (group times (count plus 1) plus start) of table to choice.\n\nThe answer is item (groups times (count plus 1)) of table. Report answer.\n","expected":"20.0000\n","step_budget":2000000},{"id":814,"slug":"binary-tree-pruning","title":"Binary Tree Pruning","difficulty":"Medium","category":"Depth-First Search","code":"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.\n\nTo 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.\n\nTrim 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.\nRepeat while head is less than count.\nThe 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.\n\nRepeat while the last position of pieces is at least 0.\nThe 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.\n\nThe line is join pieces with \",\". Display line.\n","expected":"1,null,0,null,1\n","step_budget":2000000},{"id":815,"slug":"bus-routes","title":"Bus Routes","difficulty":"Hard","category":"Array","code":"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.\nFor every spot from 0 to 63.\nPlace 0 into links.\n\nTo 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.\n\nTo weave from route (a whole number). The start is item route of begins. The finish is item route of finishes.\nFor every first from start to finish.\nFor every second from start to finish.\nThe leftstop is item first of stops. The rightstop is item second of stops. Connect from leftstop with rightstop.\n\nFor every route from 0 to 1.\nWeave from route.\n\nThe 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.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head.\nFor every other from 0 to 7.\nIf item (node times 8 plus other) of links is 1 and item other of visited is 0.\nSet 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.\n\nShow item 6 of distances.\n","expected":"2\n","step_budget":2000000},{"id":816,"slug":"ambiguous-coordinates","title":"Ambiguous Coordinates","difficulty":"Medium","category":"String","code":"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.\n\nTo resetleft.\nRepeat while the number of items in lefts is more than 0.\nRemove the last item from lefts.\n\nTo resetright.\nRepeat while the number of items in rights is more than 0.\nRemove the last item from rights.\n\nTo 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.\nFor every dot from start plus 1 to finish minus 1.\nThe 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.\n\nThe last is the last position of content.\nFor every cut from 1 to last.\nResetleft. Set side to 0. Examine from 0 with cut. Resetright. Set side to 1. Examine from cut with last plus 1.\nFor each left in lefts.\nFor each right in rights.\nThe 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.\n\nFor each answer in answers.\nShow answer.\n","expected":"(1, 23)\n(1, 2.3)\n(12, 3)\n(1.2, 3)\n","step_budget":2000000},{"id":817,"slug":"linked-list-components","title":"Linked List Components","difficulty":"Medium","category":"Array","code":"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.\nFor every spot from 0 to last.\nThe 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.\n\nShow total.\n","expected":"2\n","step_budget":2000000},{"id":818,"slug":"race-car","title":"Race Car","difficulty":"Hard","category":"Dynamic Programming","code":"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.\nFor every spot from 0 to target.\nPlace 0 into ways.\n\nTo seek from value (a whole number). Set exponent to 0.\nFor every place from 0 to 7.\nIf item place of powers is at most value, set exponent to place.\n\nTo 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.\nFor every shorter from 0 to power minus 1.\nThe 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.\n\nSet item 0 of ways to 0.\nFor every step from 1 to target.\nSeek 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.\n\nShow item target of ways.\n","expected":"2\n","step_budget":2000000},{"id":819,"slug":"most-common-word","title":"Most Common Word","difficulty":"Easy","category":"Array","code":"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.\n\nTo 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.\n\nTo 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.\n\nTo forbid. Set forbid to 0.\nFor every spot from 0 to the last position of banned.\nIf item spot of banned matches targetword, set forbid to 1.\n\nTo raise from spot (a whole number). Increase item spot of counts by 1.\n\nTo locate. Set place to -1.\nFor every spot from 0 to the last position of seen.\nIf item spot of seen matches targetword, set place to spot.\n\nThe last is the last position of source. The normalized is empty text.\nFor every spot from 0 to last.\nSoften from spot. Place lowered into normalized.\n\nThe 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.\nFor every spot from 0 to washedlast.\nThe 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.\n\nIf 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.\nFor each word in words.\nSet 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.\n\nThe best is 0. The answer is empty text.\nFor every spot from 0 to the last position of counts.\nIf item spot of counts is more than best, set best to item spot of counts, set answer to item spot of seen.\n\nShow answer.\n","expected":"ball\n","step_budget":2000000},{"id":820,"slug":"short-encoding-of-words","title":"Short Encoding of Words","difficulty":"Medium","category":"Array","code":"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.\n\nTo measure from spot (a whole number). Set measured to 0. The word is item spot of words.\nFor every place from 0 to the last position of word.\nAdd 1 to measured.\n\nTo 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.\n\nTo cover from spot (a whole number). Set covered to 0. Measure from spot. The heresize is measured.\nFor every other from 0 to the last position of words.\nMeasure from other. The othersize is measured. If other is not spot and othersize is more than heresize, suffix from other with spot.\n\nTo extend from spot (a whole number). Measure from spot. The size is measured. Add size plus 1 to total.\n\nFor every spot from 0 to the last position of words.\nCover from spot. If covered is 0, extend from spot.\n\nShow total.\n","expected":"10\n","step_budget":2000000},{"id":821,"slug":"shortest-distance-to-a-character","title":"Shortest Distance to a Character","difficulty":"Easy","category":"Array","code":"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.\nFor every spot from 0 to last.\nPlace 1000 into distances.\n\nThe nearest is 1000.\nFor every spot from 0 to last.\nThe 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.\n\nSet nearest to 1000.\nFor every step from 0 to last.\nThe 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.\n\nFor each value in distances.\nShow value.\n","expected":"3\n2\n1\n0\n1\n0\n0\n1\n2\n2\n1\n0\n","step_budget":2000000},{"id":822,"slug":"card-flipping-game","title":"Card Flipping Game","difficulty":"Medium","category":"Array","code":"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.\nFor every spot from 0 to last.\nThe 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.\n\nThe best is 100.\nFor every value from 0 to 7.\nIf item value of present is 1 and item value of blocked is 0 and value is less than best, set best to value.\n\nIf best is 100, show 0, otherwise show best.\n","expected":"2\n","step_budget":2000000},{"id":823,"slug":"binary-trees-with-factors","title":"Binary Trees With Factors","difficulty":"Medium","category":"Array","code":"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.\nFor every spot from 0 to last.\nPlace 0 into ways.\n\nFor every spot from 0 to last.\nSet item spot of ways to 1.\nFor every left from 0 to spot minus 1.\nFor every right from left to spot minus 1.\nThe product is item left of numbers times item right of numbers.\nIf product is item spot of numbers.\nThe 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.\n\nThe total is 0.\nFor each value in ways.\nAdd value to total.\n\nShow total.\n","expected":"7\n","step_budget":2000000},{"id":824,"slug":"goat-latin","title":"Goat Latin","difficulty":"Easy","category":"String","code":"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.\n\nTo 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.\n\nTo pad from count (a whole number).\nFor every step from 0 to count.\nPlace \"a\" into converted.\n\nThe answers is an empty list of text. The position is 0.\nFor every spot from 0 to the last position of words.\nThe 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.\n\nThe line is join answers with \" \". Show line.\n","expected":"Imaa peaksmaaa oatGmaaaa atinLmaaaaa\n","step_budget":2000000},{"id":825,"slug":"friends-of-appropriate-ages","title":"Friends Of Appropriate Ages","difficulty":"Medium","category":"Array","code":"The ages is a list of 20, 30, 100, 110, and 120. Keep a shared good of 0.\n\nTo 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.\n\nThe total is 0.\nFor every first from 0 to the last position of ages.\nFor every second from 0 to the last position of ages.\nTest from item first of ages with item second of ages. If first is not second and good is 1, add 1 to total.\n\nShow total.\n","expected":"3\n","step_budget":2000000},{"id":826,"slug":"most-profit-assigning-work","title":"Most Profit Assigning Work","difficulty":"Medium","category":"Array","code":"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.\n\nTo score from ability (a whole number). Set best to 0.\nFor every job from 0 to the last position of difficulty.\nIf item job of difficulty is at most ability and item job of profit is more than best, set best to item job of profit.\n\nThe total is 0.\nFor each worker in workers.\nScore from worker. Add best to total.\n\nShow total.\n","expected":"100\n","step_budget":2000000},{"id":827,"slug":"making-a-large-island","title":"Making A Large Island","difficulty":"Hard","category":"Array","code":"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.\nFor every spot from 0 to 3.\nPlace -1 into labels.\n\nTo 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.\n\nFor every node from 0 to 3.\nIf item node of chart is 1 and item node of labels is -1.\nSet count to 0. Paint from node. Place count into sizes. Increase tint by 1.\n\nThe best is 0.\nFor every node from 0 to 3.\nIf item node of chart is 0.\nThe 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.\nFor each label in near.\nIf 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.\n\nIf best is 0, set best to rows times columns. Show best.\n","expected":"3\n","step_budget":2000000},{"id":828,"slug":"count-unique-characters-of-all-substrings-of-a-given-string","title":"Count Unique Characters of All Substrings of a Given String","difficulty":"Hard","category":"String","code":"Keep a shared word as empty text. Place \"ABA\" into word. Keep a shared symbol as empty text. Keep a shared fresh of 0. Keep a shared unique of 0.\n\nTo check up to high (a whole number) with spot (a whole number). If spot is more than high, return. The other is the slice of word from spot to spot plus 1. If other matches symbol, set fresh to 0, return. Check up to high with spot plus 1.\n\nTo judge from start (a whole number) with finish (a whole number) and spot (a whole number). If spot is more than finish, return. Set symbol to the slice of word from spot to spot plus 1. Set fresh to 1. Check up to spot minus 1 with start. Check up to finish with spot plus 1. If fresh is 1, add 1 to unique. Judge from start with finish and spot plus 1.\n\nThe total is 0.\nFor every start from 0 to 2.\nFor every finish from start to 2.\nSet unique to 0. Judge from start with finish and start. Add unique to total.\n\nShow total.\n","expected":"8\n","step_budget":2000000},{"id":829,"slug":"consecutive-numbers-sum","title":"Consecutive Numbers Sum","difficulty":"Hard","category":"Math","code":"The target is 15. The ways is 0. The length is 1.\nRepeat while length times (length plus 1) divided by 2 is at most target.\nThe rest is length times (length minus 1) divided by 2. The start is target minus rest. If start modulo length is 0 and start divided by length is more than 0, add 1 to ways. Add 1 to length.\n\nShow ways.\n","expected":"4\n","step_budget":2000000},{"id":830,"slug":"positions-of-large-groups","title":"Positions of Large Groups","difficulty":"Easy","category":"String","code":"Keep a shared source as empty text. Place \"abbxxxxzzy\" into source. Keep a shared last of the last position of source. Keep a shared answers as an empty list of text. Keep a shared closing of 0.\n\nTo store from openat (a whole number) with closeat (a whole number). The line is empty text. Place \"[\" into line. The firsttext is format whole number openat as text. Place firsttext into line. Place \",\" into line. The secondtext is format whole number closeat as text. Place secondtext into line. Place \"]\" into line. The copy is a copy of line. Place copy into answers.\n\nTo check from spot (a whole number). The next is spot plus 1. If next is more than last, set closing to 1, return. The current is the slice of source from spot to spot plus 1. The following is the slice of source from next to next plus 1. If current does not match following, set closing to 1.\n\nThe start is 0.\nFor every spot from 0 to last.\nSet closing to 0. Check from spot. The span is spot minus start plus 1. If closing is 1 and span is at least 3, Store from start with spot. If closing is 1, set start to spot plus 1.\n\nFor each answer in answers, show answer.\n","expected":"[3,6]\n","step_budget":2000000},{"id":831,"slug":"masking-personal-information","title":"Masking Personal Information","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Place \"Alice@Example.com\" into source. Keep a shared bigletters as empty text. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into bigletters. Keep a shared smallletters as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into smallletters. Keep a shared current as empty text. Keep a shared converted as empty text. Keep a shared softened as empty text. Keep a shared domaintext as empty text. Keep a shared line as empty text. Keep a shared digits as empty text. Keep a shared lowdigit as empty text. Place \"0\" into lowdigit. Keep a shared highdigit as empty text. Place \"9\" into highdigit. Keep a shared foundspot of 0.\n\nTo lower from spot (a whole number). If spot is more than 25, return. The bigpiece is the slice of bigletters from spot to spot plus 1. If bigpiece matches current, set converted to the slice of smallletters from spot to spot plus 1, return. Lower from spot plus 1.\n\nTo soften from spot (a whole number). If spot is more than the last position of domaintext, return. Set current to the slice of domaintext from spot to spot plus 1. Set converted to current. Lower from 0. Place converted into softened. Soften from spot plus 1.\n\nTo pad from count (a whole number) with limit (a whole number). If count is at least limit, return. Place \"*\" into line. Pad from count plus 1 with limit.\n\nTo findat from spot (a whole number). If spot is more than the last position of source, return. The piece is the slice of source from spot to spot plus 1. If piece matches \"@\", set foundspot to spot, return. Findat from spot plus 1.\n\nTo veil. Findat from 0. The person is the slice of source from 0 to foundspot. The sourcelast is the last position of source. The finish is sourcelast plus 1. The begin is foundspot plus 1. The domain is the slice of source from begin to finish. Set domaintext to domain. Set current to the slice of person from 0 to 1. Set converted to current. Lower from 0. The firstletter is converted. The lastspot is the last position of person. The localsize is lastspot plus 1. The endspot is localsize minus 1. Set current to the slice of person from endspot to localsize. Set converted to current. Lower from 0. The lastletter is converted. Set line to empty text. Place firstletter into line. Pad from 0 with localsize minus 2. Place lastletter into line. Place \"@\" into line. Set softened to empty text. Soften from 0. Place softened into line. Show line.\n\nTo gather digits from spot (a whole number). If spot is more than the last position of source, return. The piece is the slice of source from spot to spot plus 1. If piece comes before lowdigit, Gather digits from spot plus 1, return. If highdigit comes before piece, Gather digits from spot plus 1, return. Place piece into digits. Gather digits from spot plus 1.\n\nTo cloak. Set digits to empty text. Gather digits from 0. The lastdigit is the last position of digits. The start is lastdigit minus 3. The tail is the slice of digits from start to lastdigit plus 1. Set line to empty text. Place \"***-***-\" into line. Place tail into line. Show line.\n\nThe postal is 0.\nFor every spot from 0 to the last position of source.\nThe piece is the slice of source from spot to spot plus 1. If piece matches \"@\", set postal to 1.\n\nIf postal is 1, Veil. If postal is 0, Cloak.\n","expected":"a***e@example.com\n","step_budget":4540383},{"id":832,"slug":"flipping-an-image","title":"Flipping an Image","difficulty":"Easy","category":"Array","code":"The image is a list of 1, 1, 0, 1, 0, 1, 0, 0, and 0. The answers is an empty list of text.\nFor every row from 0 to 2.\nThe line is empty text. Place \"[\" into line.\nFor every column from 0 to 2.\nThe mirror is 2 minus column. The value is item (row times 3 plus mirror) of image. The flipped is 1 minus value. The piece is format whole number flipped as text. If column is more than 0, Place \",\" into line. Place piece into line. If column is 2, Place \"]\" into line. If column is 2, The copy is a copy of line, Place copy into answers.\n\nFor each answer in answers, show answer.\n","expected":"[1,0,0]\n[0,1,0]\n[1,1,1]\n","step_budget":2000000},{"id":833,"slug":"find-and-replace-in-string","title":"Find And Replace in String","difficulty":"Medium","category":"Array","code":"Keep a shared source as empty text. Place \"abcd\" into source. Keep a shared indices holding 2 and 0. Keep a shared sources holding \"cd\" and \"a\". Keep a shared targets holding \"ffff\" and \"eee\". Keep a shared used holding 0 and 0. Keep a shared ordercount of 2. Keep a shared best of 0. Keep a shared pick of 0. Keep a shared cursor of 0. Keep a shared result as empty text.\n\nTo seek from slot (a whole number). If slot is at least ordercount, return.\nIf item slot of used is 0 and item slot of indices is less than best.\nSet best to item slot of indices. Set pick to slot. Seek from slot plus 1.\n\nTo render from spot (a whole number) with slot (a whole number). If spot is less than cursor, return. The head is the slice of source from cursor to spot. Place head into result. Set cursor to spot. The pattern is item slot of sources. The patternlast is the last position of pattern. The size is patternlast plus 1. The finish is spot plus size. The piece is the slice of source from spot to finish. If piece matches pattern, Place item slot of targets into result. If piece matches pattern, Set cursor to finish. If piece does not match pattern, Place piece into result. If piece does not match pattern, Set cursor to finish.\n\nThe step is 0.\nRepeat while step is less than ordercount.\nSet best to 1000000. Set pick to -1. Seek from 0. The slot is pick. Set item slot of used to 1. The spot is item slot of indices. Render from spot with slot. Increase step by 1.\n\nThe endspot is the last position of source. The tail is the slice of source from cursor to endspot plus 1. Place tail into result. Show result.\n","expected":"eeebffff\n","step_budget":2000000},{"id":834,"slug":"sum-of-distances-in-tree","title":"Sum of Distances in Tree","difficulty":"Hard","category":"Dynamic Programming","code":"Keep a shared lefts holding 0, 0, 2, 2, and 2. Keep a shared rights holding 1, 2, 3, 4, and 5. Keep a shared sizes as an empty list of whole numbers. Keep a shared answers as an empty list of whole numbers. Keep a shared travel of 0. Keep a shared gain of 0.\nFor every place from 0 to 5.\nPlace 0 into sizes. Place 0 into answers.\n\nTo measure from node (a whole number) with parent (a whole number). Set item node of sizes to 1.\nFor every edge from 0 to 4.\nThe first is item edge of lefts. The second is item edge of rights. If first is node and second is not parent, Measure from second with node. If first is node and second is not parent, Set item node of sizes to item node of sizes plus item second of sizes. If second is node and first is not parent, Measure from first with node. If second is node and first is not parent, Set item node of sizes to item node of sizes plus item first of sizes.\n\nTo gather from node (a whole number) with parent (a whole number) and depth (a whole number). Increase travel by depth.\nFor every edge from 0 to 4.\nThe first is item edge of lefts. The second is item edge of rights. If first is node and second is not parent, Gather from second with node and depth plus 1. If second is node and first is not parent, Gather from first with node and depth plus 1.\n\nTo spread from node (a whole number) with parent (a whole number).\nFor every edge from 0 to 4.\nThe first is item edge of lefts. The second is item edge of rights. If first is node and second is not parent, Set gain to 6 minus 2 times item second of sizes. If first is node and second is not parent, Set item second of answers to item node of answers plus gain. If first is node and second is not parent, Spread from second with node. If second is node and first is not parent, Set gain to 6 minus 2 times item first of sizes. If second is node and first is not parent, Set item first of answers to item node of answers plus gain. If second is node and first is not parent, Spread from first with node.\n\nMeasure from 0 with -1. Set travel to 0. Gather from 0 with -1 and 0. Set item 0 of answers to travel. Spread from 0 with -1. The line is empty text.\nFor every node from 0 to 5.\nIf node is more than 0, Place \",\" into line. The piece is format whole number item node of answers as text. Place piece into line.\n\nShow line.\n","expected":"8,12,6,10,10,10\n","step_budget":2000000},{"id":835,"slug":"image-overlap","title":"Image Overlap","difficulty":"Medium","category":"Array","code":"Keep a shared first holding 1, 1, 0, 0, 1, 0, 0, 1, and 0. Keep a shared second holding 0, 0, 0, 0, 1, 1, 0, 0, and 1. Keep a shared best of 0.\n\nTo score from down (a whole number) with across (a whole number). The overlap is 0.\nFor every sourcerow from 0 to 2.\nFor every sourcecolumn from 0 to 2.\nThe sourcevalue is item (sourcerow times 3 plus sourcecolumn) of first. The targetrow is sourcerow plus down. The targetcolumn is sourcecolumn plus across.\nIf sourcevalue is 1 and targetrow is at least 0 and targetrow is less than 3 and targetcolumn is at least 0 and targetcolumn is less than 3.\nThe targetvalue is item (targetrow times 3 plus targetcolumn) of second. If targetvalue is 1, add 1 to overlap. If overlap is more than best, set best to overlap.\n\nFor every rowshift from 0 to 4.\nThe down is rowshift minus 2.\nFor every columnshift from 0 to 4.\nThe across is columnshift minus 2. Score from down with across.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":836,"slug":"rectangle-overlap","title":"Rectangle Overlap","difficulty":"Easy","category":"Math","code":"The first is a list of 0, 0, 2, and 2. The second is a list of 1, 1, 3, and 3. The apart is 0.\nFor every axis from 0 to 1.\nThe firstlow is item axis of first. The firsthigh is item (axis plus 2) of first. The secondlow is item axis of second. The secondhigh is item (axis plus 2) of second. If firsthigh is at most secondlow, set apart to 1. If secondhigh is at most firstlow, set apart to 1.\n\nIf apart is 1, show \"false\". If apart is 0, show \"true\".\n","expected":"true\n","step_budget":2000000},{"id":837,"slug":"new-21-game","title":"New 21 Game","difficulty":"Medium","category":"Math","code":"Keep a shared chances as an empty list of decimals. Keep a shared maxpoints of 0. Keep a shared faces as a decimal. Keep a shared stopping of 0. Set maxpoints to 10. Set faces to 10.0. Set stopping to 1.\nFor every place from 0 to 6.\nPlace 0.0 into chances.\n\nTo imagine from score (a whole number). The total is 0.0.\nFor every step from 1 to maxpoints.\nThe prior is score minus step. If prior is at least 0 and prior is less than stopping, The value is item prior of chances, Set total to total plus value. If step is maxpoints, Set item score of chances to total divided by faces.\n\nSet item 0 of chances to 1.0.\nFor every score from 1 to 6.\nImagine from score.\n\nThe answer is 0.0.\nFor every score from 1 to 6.\nThe part is item score of chances. Add part to answer.\n\nShow answer.\n","expected":"0.6000\n","step_budget":2000000},{"id":838,"slug":"push-dominoes","title":"Push Dominoes","difficulty":"Medium","category":"String","code":"The source is \".L.R...LR..L..\". The last is the last position of source. The extent is 14. The rightforce is a list of 14 zeros. The leftforce is a list of 14 zeros. The verdict is a list of 14 zeros. The lastright is -1.\nFor every spot from 0 to last.\nThe symbol is the slice of source from spot to spot plus 1. If symbol matches \"R\", set lastright to spot. If symbol matches \"L\", set lastright to -1. If lastright is at least 0, set item spot of rightforce to spot minus lastright. If lastright is less than 0, set item spot of rightforce to extent.\n\nThe lastleft is -1. The spot is last.\nRepeat while spot is at least 0.\nThe symbol is the slice of source from spot to spot plus 1. If symbol matches \"L\", set lastleft to spot. If symbol matches \"R\", set lastleft to -1. If lastleft is at least 0, set item spot of leftforce to lastleft minus spot. If lastleft is less than 0, set item spot of leftforce to extent. Decrease spot by 1.\n\nFor every spot from 0 to last.\nThe symbol is the slice of source from spot to spot plus 1. If symbol matches \"R\", set item spot of verdict to 1. If symbol matches \"L\", set item spot of verdict to 2.\nIf symbol matches \".\".\nThe fromright is item spot of rightforce. The fromleft is item spot of leftforce. If fromright is less than fromleft, set item spot of verdict to 1. If fromleft is less than fromright, set item spot of verdict to 2.\n\nThe result is empty text.\nFor each state in verdict.\nIf state is 0, Place \".\" into result. If state is 1, Place \"R\" into result. If state is 2, Place \"L\" into result.\n\nShow result.\n","expected":"LL.RR.LLRRLL..\n","step_budget":2000000},{"id":839,"slug":"similar-string-groups","title":"Similar String Groups","difficulty":"Hard","category":"Array","code":"Keep a shared words holding \"tars\", \"rats\", \"arts\", and \"star\". Keep a shared graph as an empty list of whole numbers. Keep a shared seen as an empty list of whole numbers. Keep a shared firstword as empty text. Keep a shared secondword as empty text. Keep a shared differences of 0. Keep a shared leftspot of 0. Keep a shared rightspot of 0. Keep a shared alike of 0.\nFor every place from 0 to 15.\nPlace 0 into graph.\nFor every place from 0 to 3.\nPlace 0 into seen.\n\nTo finish. Set alike to 0. If differences is 0, set alike to 1, return. If differences is not 2, return. The firstleft is the slice of firstword from leftspot to leftspot plus 1. The firstright is the slice of firstword from rightspot to rightspot plus 1. The secondleft is the slice of secondword from leftspot to leftspot plus 1. The secondright is the slice of secondword from rightspot to rightspot plus 1.\nIf firstleft matches secondright.\nIf firstright matches secondleft, set alike to 1.\n\nTo scan from spot (a whole number). If spot is more than the last position of firstword, Finish, return. The one is the slice of firstword from spot to spot plus 1. The two is the slice of secondword from spot to spot plus 1. If one does not match two, add 1 to differences, set rightspot to leftspot, set leftspot to spot. Scan from spot plus 1.\n\nTo check from first (a whole number) with second (a whole number). Set alike to 0. Set firstword to item first of words. Set secondword to item second of words. Set differences to 0. Set leftspot to -1. Set rightspot to -1. If firstword matches secondword, set alike to 1, return. Scan from 0.\n\nTo visit from node (a whole number). If item node of seen is 1, return. Set item node of seen to 1.\nFor every other from 0 to 3.\nIf item (node times 4 plus other) of graph is 1 and item other of seen is 0, Visit from other.\n\nFor every pair from 0 to 15.\nThe first is pair divided by 4. The second is pair modulo 4.\nIf first is less than second.\nCheck from first with second. If alike is 1, set item (first times 4 plus second) of graph to 1. If alike is 1, set item (second times 4 plus first) of graph to 1.\n\nThe groups is 0.\nFor every start from 0 to 3.\nIf item start of seen is 0, add 1 to groups. If item start of seen is 0, Visit from start.\n\nShow groups.\n","expected":"2\n","step_budget":2000000},{"id":840,"slug":"magic-squares-in-grid","title":"Magic Squares In Grid","difficulty":"Medium","category":"Array","code":"Keep a shared grid as an empty list of whole numbers. Keep a shared rows of 0. Keep a shared columns of 0. Keep a shared total of 0. Keep a shared valid of 0. Keep a shared marks as an empty list of whole numbers. Place 4 into grid. Place 3 into grid. Place 8 into grid. Place 4 into grid. Place 9 into grid. Place 5 into grid. Place 1 into grid. Place 9 into grid. Place 2 into grid. Place 7 into grid. Place 6 into grid. Place 2 into grid. Place 0 into marks. Place 0 into marks. Place 0 into marks. Place 0 into marks. Place 0 into marks. Place 0 into marks. Place 0 into marks. Place 0 into marks. Place 0 into marks. Place 0 into marks.\n\nTo inspect from top (a whole number) with column (a whole number). Set valid to 1. The base is top times columns plus column. The stamp is top times columns plus column plus 1. The northwest is item base of grid. The north is item (base plus 1) of grid. The northeast is item (base plus 2) of grid. The west is item (base plus columns) of grid. The middle is item (base plus columns plus 1) of grid. The east is item (base plus columns plus 2) of grid. The southwest is item (base plus columns plus columns) of grid. The south is item (base plus columns plus columns plus 1) of grid. The southeast is item (base plus columns plus columns plus 2) of grid. If northwest is less than 1 or northwest is more than 9, return. If north is less than 1 or north is more than 9, return. If northeast is less than 1 or northeast is more than 9, return. If west is less than 1 or west is more than 9, return. If middle is less than 1 or middle is more than 9, return. If east is less than 1 or east is more than 9, return. If southwest is less than 1 or southwest is more than 9, return. If south is less than 1 or south is more than 9, return. If southeast is less than 1 or southeast is more than 9, return. If item northwest of marks is stamp, set valid to 0, otherwise set item northwest of marks to stamp. If item north of marks is stamp, set valid to 0, otherwise set item north of marks to stamp. If item northeast of marks is stamp, set valid to 0, otherwise set item northeast of marks to stamp. If item west of marks is stamp, set valid to 0, otherwise set item west of marks to stamp. If item middle of marks is stamp, set valid to 0, otherwise set item middle of marks to stamp. If item east of marks is stamp, set valid to 0, otherwise set item east of marks to stamp. If item southwest of marks is stamp, set valid to 0, otherwise set item southwest of marks to stamp. If item south of marks is stamp, set valid to 0, otherwise set item south of marks to stamp. If item southeast of marks is stamp, set valid to 0, otherwise set item southeast of marks to stamp. The firstrow is northwest plus north plus northeast. The secondrow is west plus middle plus east. The thirdrow is southwest plus south plus southeast. The firstcolumn is northwest plus west plus southwest. The secondcolumn is north plus middle plus south. The thirdcolumn is northeast plus east plus southeast. The diagonal is northwest plus middle plus southeast. The cross is northeast plus middle plus southwest. If valid is 1 and firstrow is 15 and secondrow is 15 and thirdrow is 15 and firstcolumn is 15 and secondcolumn is 15 and thirdcolumn is 15 and diagonal is 15 and cross is 15, add 1 to total.\n\nSet rows to 3. Set columns to 4.\nFor every top from 0 to rows minus 3.\nFor every column from 0 to columns minus 3.\nInspect from top with column.\n\nShow total.\n","expected":"1\n","step_budget":2000000},{"id":841,"slug":"keys-and-rooms","title":"Keys and Rooms","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared edges holding 1, 2, and 3. Keep a shared starts holding 0, 1, 2, and 3. Keep a shared counts holding 1, 1, 1, and 0. Keep a shared queue as an empty list of whole numbers. Keep a shared seen as an empty list of whole numbers.\nFor every room from 0 to 3.\nPlace 0 into seen.\n\nPlace 0 into queue. Set item 0 of seen to 1. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head.\nFor every offset from 0 to item node of counts minus 1.\nThe target is item (item node of starts plus offset) of edges.\nIf item target of seen is 0.\nSet item target of seen to 1. Place target into queue. Add 1 to count.\n\nThe reached is 0.\nFor every room from 0 to 3.\nIf item room of seen is 1, add 1 to reached.\n\nIf reached is 4, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":842,"slug":"split-array-into-fibonacci-sequence","title":"Split Array into Fibonacci Sequence","difficulty":"Medium","category":"String","code":"Keep a shared digits as empty text. Keep a shared chosen as an empty list of whole numbers. Keep a shared answer as an empty list of whole numbers. Keep a shared parsed of 0. Keep a shared found of 0. Keep a shared size of 0.\n\nTo parse from start (a whole number) with finish (a whole number). Set parsed to 0.\nFor every spot from start to finish.\nThe number is the digit value of character spot of digits. Set parsed to parsed times 10 plus number.\n\nTo collect from spot (a whole number) with limit (a whole number). If spot is at least limit, return. Place item spot of chosen into answer. Collect from spot plus 1 with limit.\n\nTo extend from start (a whole number) with depth (a whole number). If found is 1, return. If start is size and depth is at least 3, Collect from 0 with depth, set found to 1. If start is size, return.\nFor every finish from start to size minus 1.\nThe lead is the digit value of character start of digits. If finish is more than start and lead is 0, stop. Parse from start with finish. If parsed is more than 2147483647, stop. The valid is 0. If depth is less than 2, set valid to 1. If depth is at least 2 and parsed is item (depth minus 1) of chosen plus item (depth minus 2) of chosen, set valid to 1.\nIf valid is 1.\nPlace parsed into chosen. Extend from finish plus 1 with depth plus 1. Remove the last item from chosen.\n\nPlace \"123456579\" into digits. Set size to 9. Extend from 0 with 0. The rendered is empty text.\nIf found is 1.\nFor every spot from 0 to the last position of answer.\nIf spot is more than 0, place \",\" into rendered. Place format whole number item spot of answer as text into rendered.\n\nIf found is 1, show rendered. If found is 0, show \"[]\".\n","expected":"123,456,579\n","step_budget":2000000},{"id":844,"slug":"backspace-string-compare","title":"Backspace String Compare","difficulty":"Easy","category":"String","code":"The source is \"ab#c\", while the other is \"ad#c\". The cleaned is empty text. The trimmed is empty text. The kept is 0, while the spared is 0.\nFor every spot from 0 to 3.\nThe symbol is the slice of source from spot to spot plus 1. The retreat is 0. If symbol matches \"#\", set retreat to 1. If retreat is 1 and kept is more than 0, remove last character from cleaned, subtract 1 from kept. If retreat is 0, place symbol into cleaned, add 1 to kept.\n\nFor every spot from 0 to 3.\nThe symbol is the slice of other from spot to spot plus 1. The retreat is 0. If symbol matches \"#\", set retreat to 1. If retreat is 1 and spared is more than 0, remove last character from trimmed, subtract 1 from spared. If retreat is 0, place symbol into trimmed, add 1 to spared.\n\nIf cleaned matches trimmed, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":845,"slug":"longest-mountain-in-array","title":"Longest Mountain in Array","difficulty":"Medium","category":"Array","code":"The heights is a list of 2, 1, 4, 7, 3, 2, 5. The last is 6. The climbing is a list of 7 zeros. Set item 0 of climbing to 1.\nFor every spot from 1 to last.\nIf item spot of heights is more than item (spot minus 1) of heights, set item spot of climbing to item (spot minus 1) of climbing plus 1, otherwise set item spot of climbing to 1.\n\nThe falling is a list of 7 zeros. Set item last of falling to 1. The spot is last minus 1.\nRepeat while spot is at least 0.\nIf item spot of heights is more than item (spot plus 1) of heights, set item spot of falling to item (spot plus 1) of falling plus 1, otherwise set item spot of falling to 1. Subtract 1 from spot.\n\nThe best is 0.\nFor every spot from 0 to last.\nIf item spot of climbing is more than 1 and item spot of falling is more than 1.\nThe span is item spot of climbing plus item spot of falling minus 1. If span is more than best, set best to span.\n\nShow best.\n","expected":"5\n","step_budget":2000000},{"id":846,"slug":"hand-of-straights","title":"Hand of Straights","difficulty":"Medium","category":"Array","code":"Keep a shared hand holding 1, 2, 3, 6, 2, 3, 4, 7, and 8. Keep a shared used holding 0, 0, 0, 0, 0, 0, 0, 0, and 0. Keep a shared last of 0. Keep a shared hit of 0.\n\nTo seek from look (a whole number) with want (a whole number). If look is more than last, return. If item look of used is 0 and item look of hand is want, set hit to look, return. Seek from look plus 1 with want.\n\nSet last to 8. Sort hand. The possible is 1. The group is 3.\nFor every spot from 0 to last.\nIf possible is 0, stop.\nIf item spot of used is 0.\nThe base is item spot of hand. The need is 0.\nRepeat while need is less than group and possible is 1.\nSet hit to -1. Seek from spot with base plus need. If hit is less than 0, set possible to 0. If hit is at least 0, set item hit of used to 1. Add 1 to need.\n\nIf possible is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":847,"slug":"shortest-path-visiting-all-nodes","title":"Shortest Path Visiting All Nodes","difficulty":"Hard","category":"Dynamic Programming","code":"The edges is a list of 1, 2, 3, 0, 0, 0. The starts is a list of 0, 3, 4, 5. The counts is a list of 3, 1, 1, 1. The seen is a list of 64 zeros. The queue is an empty list of whole numbers. The depths is an empty list of whole numbers.\nFor every node from 0 to 3.\nThe startmask is shift 1 left by node. The code is node times 16 plus startmask. Set item code of seen to 1. Place code into queue. Place 0 into depths.\n\nThe head is 0. The count is 4. The answer is -1.\nRepeat while head is less than count and answer is less than 0.\nThe state is item head of queue. The distance is item head of depths. Add 1 to head. The node is state divided by 16. The mask is state modulo 16.\nFor every offset from 0 to item node of counts minus 1.\nThe target is item (item node of starts plus offset) of edges. The bit is shift 1 left by target. The merged is bitwise or of mask and bit. If merged is 15, set answer to distance plus 1, stop. The code is target times 16 plus merged.\nIf item code of seen is 0.\nSet item code of seen to 1. Place code into queue. Place distance plus 1 into depths. Add 1 to count.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":848,"slug":"shifting-letters","title":"Shifting Letters","difficulty":"Medium","category":"Array","code":"Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared symbol as empty text. Keep a shared found of 0.\n\nTo locate from look (a whole number). The piece is the slice of alphabet from look to look plus 1. If piece matches symbol, set found to look, return. Locate from look plus 1.\n\nThe word is \"abc\". The shifts is a list of 3, 5, 9. The last is 2. The suffix is a list of 3 zeros. The running is 0. The spot is last.\nRepeat while spot is at least 0.\nIncrease running by item spot of shifts. Set item spot of suffix to running. Subtract 1 from spot.\n\nThe result is empty text.\nFor every spot from 0 to last.\nSet symbol to the slice of word from spot to spot plus 1. Set found to 0. Locate from 0. The moved is (found plus item spot of suffix) modulo 26. The letter is the slice of alphabet from moved to moved plus 1. Place letter into result.\n\nShow result.\n","expected":"rpl\n","step_budget":2000000},{"id":849,"slug":"maximize-distance-to-closest-person","title":"Maximize Distance to Closest Person","difficulty":"Medium","category":"Array","code":"The seats is a list of 1, 0, 0, 0, 1, 0, 1, while the last is 6. The nearest is a list of 7 zeros. The lastfilled is -100.\nFor every spot from 0 to last.\nIf item spot of seats is 1, set lastfilled to spot. Set item spot of nearest to spot minus lastfilled.\n\nSet lastfilled to 100. The spot is last.\nRepeat while spot is at least 0.\nIf item spot of seats is 1, set lastfilled to spot. The distance is lastfilled minus spot. If distance is less than item spot of nearest, set item spot of nearest to distance. Subtract 1 from spot.\n\nThe best is 0.\nFor every spot from 0 to last.\nIf item spot of seats is 0 and item spot of nearest is more than best, set best to item spot of nearest.\n\nShow best.\n","expected":"2\n","step_budget":2000000},{"id":850,"slug":"rectangle-area-ii","title":"Rectangle Area II","difficulty":"Hard","category":"Array","code":"The rects is a list of 0, 0, 2, 2, 1, 0, 2, 3, 1, 0, 3, 1. The rawx is a list of 0, 2, 1, 2, 1, 3. The rawy is a list of 0, 2, 0, 3, 0, 1. Sort rawx. Sort rawy. The xedges is an empty list of whole numbers. The yedges is an empty list of whole numbers. The recent is -1.\nFor each value in rawx.\nIf value is not recent, place value into xedges, set recent to value.\n\nSet recent to -1.\nFor each value in rawy.\nIf value is not recent, place value into yedges, set recent to value.\n\nThe lastx is the last position of xedges. The lasty is the last position of yedges. The lastrect is the last position of rects. The entrycount is (lastrect plus 1) divided by 4. The cover is a list of 8 zeros. The area is 0.\nFor every xi from 0 to lastx minus 1.\nThe xleft is item xi of xedges. The xright is item (xi plus 1) of xedges. The width is xright minus xleft. The stamp is xi plus 1.\nFor every entry from 0 to entrycount minus 1.\nThe base is entry times 4.\nFor every yi from 0 to lasty minus 1.\nIf item base of rects is at most xleft and item (base plus 2) of rects is at least xright and item (base plus 1) of rects is at most item yi of yedges and item (base plus 3) of rects is at least item (yi plus 1) of yedges and item yi of cover is not stamp.\nSet item yi of cover to stamp. The height is item (yi plus 1) of yedges minus item yi of yedges. Increase area by width times height.\n\nShow area.\n","expected":"6\n","step_budget":2000000},{"id":851,"slug":"loud-and-rich","title":"Loud and Rich","difficulty":"Medium","category":"Array","code":"Keep a shared quiet holding 3, 2, 5, 4, 1, and 0. Keep a shared edges holding 1, 2, 3, 4, and 5. Keep a shared starts holding 0, 1, 3, 3, 5, and 5. Keep a shared counts holding 1, 2, 0, 2, 0, and 0. Keep a shared answers holding 0, 1, 2, 3, 4, and 5.\n\nTo settle from person (a whole number).\nFor every offset from 0 to item person of counts minus 1.\nThe source is item (item person of starts plus offset) of edges. Settle from source. The voice is item source of answers. If item voice of quiet is less than item person of quiet, set item person of answers to voice.\n\nFor every person from 0 to 5.\nSettle from person.\n\nThe line is empty text.\nFor each value in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number value as text into line.\n\nShow line.\n","expected":"5,5,2,5,4,5\n","step_budget":2000000},{"id":852,"slug":"peak-index-in-a-mountain-array","title":"Peak Index in a Mountain Array","difficulty":"Medium","category":"Array","code":"The heights is a list of 0, 10, 5, 2, and 1. The low is 0, while the high is the last position of heights.\nRepeat while low is less than high.\nThe middle is (low plus high) divided by 2. If item middle of heights is less than item (middle plus 1) of heights, set low to middle plus 1. If item middle of heights is more than item (middle plus 1) of heights, set high to middle.\n\nShow low.\n","expected":"1\n","step_budget":2000000},{"id":853,"slug":"car-fleet","title":"Car Fleet","difficulty":"Medium","category":"Array","code":"The positions is a list of 10, 8, 0, 5, and 3. The speeds is a list of 2, 4, 1, 1, and 3. The target is 12. The last is the last position of positions.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nIf item right of positions is more than item left of positions, swap item left of positions and item right of positions, swap item left of speeds and item right of speeds.\n\nThe leaders is an empty list of whole numbers. The paces is an empty list of whole numbers.\nFor every spot from 0 to last.\nThe here is item spot of positions. The pace is item spot of speeds. The size is the number of items in leaders. If size is 0, Place here into leaders, Place pace into paces.\nIf size is more than 0.\nThe ahead is item (size minus 1) of leaders. The cruise is item (size minus 1) of paces. The mine is (target minus here) times cruise. The theirs is (target minus ahead) times pace. If mine is more than theirs, Place here into leaders, Place pace into paces.\n\nShow the number of items in leaders.\n","expected":"3\n","step_budget":2000000},{"id":854,"slug":"k-similar-strings","title":"K-Similar Strings","difficulty":"Hard","category":"String","code":"Keep a shared source as empty text. Keep a shared goal as empty text. Place \"abc\" into source. Place \"bca\" into goal. Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared current as empty text. Keep a shared targetletter of 0. Keep a shared codes as an empty list of whole numbers. Keep a shared found of 0.\n\nTo locate from spot (a whole number). If spot is more than 25, return. The symbol is character spot of alphabet. If symbol is targetletter, set found to spot, return. Locate from spot plus 1.\n\nTo encode from spot (a whole number). If spot is more than the last position of current, return. Set targetletter to character spot of current. Set found to -1. Locate from 0. Place found into codes. Encode from spot plus 1.\n\nSet current to source. Encode from 0. Set current to goal. Encode from 0.\n\nThe final is the last position of source. Keep a shared chars as an empty list of whole numbers. Keep a shared wanted as an empty list of whole numbers.\nFor every spot from 0 to final.\nPlace item spot of codes into chars.\nFor every spot from final plus 1 to the last position of codes.\nPlace item spot of codes into wanted.\n\nKeep a shared first of 0. Keep a shared best of final plus 1.\n\nTo scan from spot (a whole number). Set first to -1.\nFor every index from spot to the last position of chars.\nIf first is -1 and item index of chars is not item index of wanted, set first to index.\n\nTo seek from spot (a whole number) with level (a whole number). If level is at least best, return. Scan from spot. The foundspot is first. If foundspot is -1, set best to level, return. Tryexact from foundspot with foundspot and level. Tryany from foundspot with foundspot and level.\n\nTo carry from first (a whole number) with index (a whole number) and level (a whole number). swap item first of chars and item index of chars. Seek from first plus 1 with level. swap item first of chars and item index of chars.\n\nTo consider from index (a whole number) with targetspot (a whole number) and level (a whole number). If item index of chars is not item targetspot of wanted, return. If item targetspot of chars is not item index of wanted, return. Carry from targetspot with index and level plus 1.\n\nTo probe from index (a whole number) with targetspot (a whole number) and level (a whole number). If item index of chars is not item targetspot of wanted, return. Carry from targetspot with index and level plus 1.\n\nTo tryexact from spot (a whole number) with targetspot (a whole number) and level (a whole number).\nFor every index from spot plus 1 to the last position of chars.\nConsider from index with targetspot and level.\n\nTo tryany from spot (a whole number) with targetspot (a whole number) and level (a whole number).\nFor every index from spot plus 1 to the last position of chars.\nProbe from index with targetspot and level.\n\nSeek from 0 with 0. Show best.\n","expected":"2\n","step_budget":2000000},{"id":856,"slug":"score-of-parentheses","title":"Score of Parentheses","difficulty":"Medium","category":"String","code":"The word is \"(()(()))\". The last is the last position of word. The stack is an empty list of whole numbers.\nFor every spot from 0 to last.\nThe symbol is character spot of word. The size is the number of items in stack. If symbol is \"(\", Place 0 into stack.\nIf symbol is \")\".\nThe inner is item (size minus 1) of stack. Remove the last item from stack. The left is the number of items in stack. The scored is 1. If inner is more than 0, set scored to inner times 2. If left is 0, Place scored into stack. If left is more than 0, set item (left minus 1) of stack to item (left minus 1) of stack plus scored.\n\nShow item 0 of stack.\n","expected":"6\n","step_budget":2000000},{"id":857,"slug":"minimum-cost-to-hire-k-workers","title":"Minimum Cost to Hire K Workers","difficulty":"Hard","category":"Array","code":"The qualities is a list of 10, 20, and 5. The wages is a list of 70, 50, and 30. The wanted is 2. The last is the last position of qualities.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nIf item right of wages times item left of qualities is less than item left of wages times item right of qualities, swap item left of qualities and item right of qualities, swap item left of wages and item right of wages.\n\nKeep a shared pool holding 0 and 0. Keep a shared filled of 0. Keep a shared total of 0. Keep a shared bestnum of 0. Keep a shared bestden of 0. Keep a shared biggest of 0. Set bestden to 1.\n\nTo largest from count (a whole number). Set biggest to 0.\nFor every spot from 1 to count minus 1.\nThe local is biggest. If item spot of pool is more than item local of pool, set biggest to spot.\n\nTo record with wage (a whole number) and quality (a whole number). The big is total times wage. If bestnum is 0 or big times bestden is less than bestnum times quality, set bestnum to big, set bestden to quality.\n\nFor every spot from 0 to last.\nThe quality is item spot of qualities. The wage is item spot of wages. The added is 0. If filled is less than wanted, set item filled of pool to quality, add quality to total, add 1 to filled, set added to 1. If filled is wanted and added is 1, Record with wage and quality.\nIf added is 0 and filled is wanted.\nLargest from filled. The top is biggest. The old is item top of pool. If quality is less than old, set total to total minus old plus quality, set item top of pool to quality, Record with wage and quality. If quality is at least old, Record with wage and quality.\n\nShow bestnum divided by bestden.\n","expected":"105\n","step_budget":2000000},{"id":858,"slug":"mirror-reflection","title":"Mirror Reflection","difficulty":"Medium","category":"Math","code":"The width is 4, while the height is 2. The left is width, while the right is height.\nRepeat while right is more than 0.\nThe carry is left modulo right. Set left to right. Set right to carry.\n\nThe short is width divided by left, while the tall is height divided by left. The corner is 1. If short modulo 2 is 0, set corner to 2. If short modulo 2 is 1 and tall modulo 2 is 0, set corner to 0.\n\nShow corner.\n","expected":"2\n","step_budget":2000000},{"id":859,"slug":"buddy-strings","title":"Buddy Strings","difficulty":"Easy","category":"String","code":"The source is \"ab\". The goal is \"ba\". The last is the last position of source. The valid is 1. The sizesource is the number of characters in source. The sizegoal is the number of characters in goal. If sizesource is not sizegoal, set valid to 0. The first is -1. The second is -1. The misses is 0.\nFor every spot from 0 to last.\nThe symbol is character spot of source. The wanted is character spot of goal. If symbol is not wanted and misses is 0, set first to spot. If symbol is not wanted and misses is 1, set second to spot. If symbol is not wanted, add 1 to misses.\n\nThe twin is 0.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nThe leftsymbol is character left of source. The rightsymbol is character right of source. If leftsymbol is rightsymbol, set twin to 1.\n\nThe answer is 0. If valid is 1 and misses is 0, set answer to twin.\nIf valid is 1 and misses is 2.\nThe leftletter is character first of source. The rightletter is character second of goal. The backletter is character second of source. The frontletter is character first of goal. If leftletter is rightletter and backletter is frontletter, set answer to 1.\n\nIf answer is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":860,"slug":"lemonade-change","title":"Lemonade Change","difficulty":"Easy","category":"Array","code":"The bills is a list of 5, 5, 5, 10, and 20. The fives is 0, while the tens is 0. The valid is 1.\nFor each bill in bills.\nIf bill is 5, add 1 to fives. If bill is 10 and fives is 0, set valid to 0. If bill is 10 and fives is more than 0, subtract 1 from fives, add 1 to tens. The paid is 0. If bill is 20 and tens is more than 0 and fives is more than 0, subtract 1 from tens, subtract 1 from fives, set paid to 1. If bill is 20 and paid is 0 and fives is at least 3, subtract 3 from fives, set paid to 1. If bill is 20 and paid is 0, set valid to 0.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":861,"slug":"score-after-flipping-matrix","title":"Score After Flipping Matrix","difficulty":"Medium","category":"Array","code":"Keep a shared rows of 0. Keep a shared columns of 0. Set rows to 3. Set columns to 4. Keep a shared grid holding 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, and 0.\nFor every row from 0 to rows minus 1.\nThe start is row times columns.\nIf item start of grid is 0.\nFor every column from 0 to columns minus 1.\nThe cell is start plus column. The flipped is exclusive or of item cell of grid and 1. Set item cell of grid to flipped.\n\nKeep a shared ones of 0. Keep a shared weight of 0.\n\nTo count from column (a whole number). Set ones to 0.\nFor every row from 0 to rows minus 1.\nThe cell is row times columns plus column. If item cell of grid is 1, add 1 to ones.\n\nTo weigh from place (a whole number). Set weight to 1.\nFor every step from 0 to place minus 1.\nSet weight to weight times 2.\n\nThe total is 0.\nFor every column from 0 to columns minus 1.\nCount from column. The taller is ones. If rows minus ones is more than taller, set taller to rows minus ones. The place is columns minus 1 minus column. Weigh from place. Increase total by taller times weight.\n\nShow total.\n","expected":"39\n","step_budget":2000000},{"id":862,"slug":"shortest-subarray-with-sum-at-least-k","title":"Shortest Subarray with Sum at Least K","difficulty":"Hard","category":"Array","code":"The numbers is a list of 2, -1, and 2. The target is 3. The last is the last position of numbers. The best is last plus 2.\nFor every start from 0 to last.\nThe total is 0.\nFor every tail from start to last.\nThe value is item tail of numbers. Add value to total.\nIf total is at least target.\nThe span is tail minus start plus 1. If span is less than best, set best to span. stop.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":863,"slug":"all-nodes-distance-k-in-binary-tree","title":"All Nodes Distance K in Binary Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared lefts holding 1, 3, 5, -1, 9, -1, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, 10, -1, -1, -1, -1, -1, and -1. Keep a shared parents as an empty list of whole numbers.\nFor every node from 0 to 10.\nPlace -2 into parents.\n\nKeep a shared queue as an empty list of whole numbers.\nFor every node from 0 to 10.\nPlace -1 into queue.\n\nKeep a shared seen as an empty list of whole numbers.\nFor every node from 0 to 10.\nPlace 0 into seen.\n\nKeep a shared distance as an empty list of whole numbers.\nFor every node from 0 to 10.\nPlace 0 into distance.\n\nKeep a shared answers as an empty list of whole numbers. Keep a shared count of 0.\n\nTo attach from node (a whole number) with parent (a whole number). If node is less than 0, return. Set item node of parents to parent. The left is item node of lefts. Attach from left with node. The right is item node of rights. Attach from right with node.\n\nTo visit from neighbor (a whole number) with depth (a whole number). If neighbor is less than 0, return. If item neighbor of seen is 1, return. Set item neighbor of seen to 1. Set item neighbor of distance to depth plus 1. The spot is count. Set item spot of queue to neighbor. Add 1 to count.\n\nTo expand from here (a whole number) with depth (a whole number). The left is item here of lefts. Visit from left with depth. The right is item here of rights. Visit from right with depth. The parent is item here of parents. Visit from parent with depth.\n\nThe values is a list of 3, 5, 1, 6, 2, 0, 8, -1, -1, 7, and 4. Attach from 0 with -1. Set item 0 of queue to 1. Set item 1 of seen to 1. Set count to 1. The head is 0.\nRepeat while head is less than count.\nThe here is item head of queue. The depth is item here of distance. Add 1 to head. If depth is 2, Place item here of values into answers. If depth is less than 2, Expand from here with depth.\n\nThe line is empty text.\nFor each value in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number value as text into line.\n\nShow line.\n","expected":"7,4,1\n","step_budget":2000000},{"id":864,"slug":"shortest-path-to-get-all-keys","title":"Shortest Path to Get All Keys","difficulty":"Hard","category":"Array","code":"Keep a shared grid holding 2, 0, 3, 0, 0, 1, 1, 1, 0, 1, 4, 0, 5, 0, and 6. Keep a shared visited as a list of 60 zeros. Keep a shared queued cells as an empty list of whole numbers. Keep a shared queued masks as an empty list of whole numbers. Keep a shared queued distances as an empty list of whole numbers. Keep a shared count of 0. Keep a shared head of 0. Keep a shared answer of 0. Keep a shared activemask of 0. Keep a shared activetravel of 0.\nTo visit from target (a whole number). The cell is item target of grid. If cell is 1, return. The gained is activemask. If cell is 3, set gained to bitwise or of activemask and 1. If cell is 4, set gained to bitwise or of activemask and 2. The keyone is bitwise and of activemask and 1. The keytwo is bitwise and of activemask and 2. If cell is 5 and keyone is 0, return. If cell is 6 and keytwo is 0, return. The mark is target times 4 plus gained. If item mark of visited is 1, return. Set item mark of visited to 1. Place target into queued cells. Place gained into queued masks. Place activetravel plus 1 into queued distances. Add 1 to count.\n\nSet item 0 of visited to 1. Place 0 into queued cells. Place 0 into queued masks. Place 0 into queued distances. Set count to 1. Set head to 0. Set answer to -1. The columns is 5. The rows is 3. The lastrow is rows minus 1. The lastcolumn is columns minus 1.\nRepeat while head is less than count.\nThe cursor is head. The spot is item cursor of queued cells. Set activemask to item cursor of queued masks. Set activetravel to item cursor of queued distances. Add 1 to head. If activemask is 3, set answer to activetravel, stop. The line is spot divided by columns. The column is spot modulo columns. If line is more than 0, Visit from spot minus columns. If line is less than lastrow, Visit from spot plus columns. If column is more than 0, Visit from spot minus 1. If column is less than lastcolumn, Visit from spot plus 1.\n\nShow answer.\n","expected":"8\n","step_budget":2000000},{"id":865,"slug":"smallest-subtree-with-all-the-deepest-nodes","title":"Smallest Subtree with all the Deepest Nodes","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 3, 5, 1, 6, 2, 0, 8, -1, -1, 7, and 4. Keep a shared lefts holding 1, 3, 5, -1, 9, -1, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, 10, -1, -1, -1, -1, -1, and -1. Keep a shared heights as an empty list of whole numbers. Keep a shared answer of 0. Keep a shared order as an empty list of whole numbers.\nTo descend from node (a whole number). The left is item node of lefts. The right is item node of rights. The leftheight is 0. The rightheight is 0. If left is at least 0, set leftheight to item left of heights. If right is at least 0, set rightheight to item right of heights. If leftheight is equal to rightheight, set answer to node, return. If leftheight is more than rightheight, Descend from left, return. Descend from right.\n\nTo gather from node (a whole number). If node is less than 0, return. Place node into order. Gather from item node of lefts. Gather from item node of rights.\n\nThe last is the last position of values.\nFor every node from 0 to last.\nPlace 0 into heights.\n\nFor every step from 0 to last.\nThe node is last minus step. The leftheight is 0. The rightheight is 0. The left is item node of lefts. The right is item node of rights. If left is at least 0, set leftheight to item left of heights. If right is at least 0, set rightheight to item right of heights. The tall is leftheight. If rightheight is more than tall, set tall to rightheight. Set item node of heights to tall plus 1.\n\nDescend from 0. Gather from answer. For each node in order, show item node of values.\n","expected":"2\n7\n4\n","step_budget":2000000},{"id":866,"slug":"prime-palindrome","title":"Prime Palindrome","difficulty":"Medium","category":"Math","code":"Keep a shared candidate of 0. Keep a shared prime of 1. Keep a shared flipped of 0. Keep a shared arrived of 0.\nTo probe from divisor (a whole number). If divisor times divisor is more than candidate, return. If candidate modulo divisor is 0, set prime to 0, return. Probe from divisor plus 1.\n\nTo flip from value (a whole number). If value is 0, return. Set flipped to flipped times 10 plus value modulo 10. Flip from value divided by 10.\n\nSet candidate to 13.\nRepeat while arrived is 0.\nSet prime to 1. Probe from 2. Set flipped to 0. Flip from candidate. If prime is 1 and flipped is candidate, set arrived to 1. If arrived is 0, add 1 to candidate.\n\nShow candidate.\n","expected":"101\n","step_budget":2000000},{"id":867,"slug":"transpose-matrix","title":"Transpose Matrix","difficulty":"Easy","category":"Array","code":"The grid is a list of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The rows is 3. The columns is 3. The lastrow is rows minus 1. The lastcolumn is columns minus 1.\nFor every column from 0 to lastcolumn.\nFor every line from 0 to lastrow.\nShow item (line times columns plus column) of grid.\n","expected":"1\n4\n7\n2\n5\n8\n3\n6\n9\n","step_budget":2000000},{"id":868,"slug":"binary-gap","title":"Binary Gap","difficulty":"Easy","category":"Bit Manipulation","code":"The value is 22. The working is value. The best is 0. The previous is -1. The spot is 0.\nRepeat while working is more than 0.\nThe low is bitwise and of working and 1. If low is 1 and previous is at least 0 and spot minus previous is more than best, set best to spot minus previous. If low is 1, set previous to spot. Set working to shift working right by 1. Add 1 to spot.\n\nShow best.\n","expected":"2\n","step_budget":2000000},{"id":869,"slug":"reordered-power-of-2","title":"Reordered Power of 2","difficulty":"Medium","category":"Math","code":"Keep a shared basecounts as an empty list of whole numbers. Keep a shared testcounts as an empty list of whole numbers. Keep a shared same of 0.\nTo mark base from value (a whole number). Repeat while value is more than 0, set digit to value modulo 10, set item digit of basecounts to item digit of basecounts plus 1, set value to value divided by 10.\n\nTo mark test from value (a whole number). Repeat while value is more than 0, set digit to value modulo 10, set item digit of testcounts to item digit of testcounts plus 1, set value to value divided by 10.\n\nTo wipe from spot (a whole number). If spot is more than 9, return. Set item spot of testcounts to 0. Wipe from spot plus 1.\n\nTo compare from spot (a whole number). If spot is more than 9, return. If item spot of basecounts is not item spot of testcounts, set same to 0, return. Compare from spot plus 1.\n\nFor every spot from 0 to 9, Place 0 into basecounts. For every spot from 0 to 9, Place 0 into testcounts. The number is 10. Mark base from number. The power is 1. The reached is 0.\nRepeat while power is at most 1000000000.\nSet same to 1. Wipe from 0. Mark test from power. Compare from 0. If same is 1, set reached to 1, stop. Set power to power times 2.\n\nIf reached is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":870,"slug":"advantage-shuffle","title":"Advantage Shuffle","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 2, 7, 11, and 15. Keep a shared aims holding 1, 10, 4, and 11. Keep a shared used holding 0, 0, 0, and 0. Keep a shared answers holding 0, 0, 0, and 0. Keep a shared pick of 0.\nTo seek from spot (a whole number) with aim (a whole number). If spot is more than the last position of numbers, return. If item spot of used is 1, seek from spot plus 1 with aim, return. If item spot of numbers is more than aim, set pick to spot, return. Seek from spot plus 1 with aim.\n\nTo spare from spot (a whole number). If spot is more than the last position of numbers, return. If item spot of used is 0, set pick to spot, return. Spare from spot plus 1.\n\nSort numbers. The place is 0.\nFor each aim in aims.\nSet pick to -1. Seek from 0 with aim. If pick is equal to -1, Spare from 0. The chosen is pick. Set item chosen of used to 1. Set item place of answers to item chosen of numbers. Add 1 to place.\n\nFor each value in answers, show value.\n","expected":"2\n11\n7\n15\n","step_budget":2000000},{"id":871,"slug":"minimum-number-of-refueling-stops","title":"Minimum Number of Refueling Stops","difficulty":"Hard","category":"Array","code":"Keep a shared places holding 10, 20, 30, and 60. Keep a shared fuels holding 60, 30, 30, and 40. Keep a shared reach holding 0, 0, 0, 0, and 0.\n\nTo expand from spot (a whole number).\nIf spot is less than 0, return. The position is item spot of places. The raised is item spot of reach plus item spot of fuels.\nIf item spot of reach is at least position and raised is more than item (spot plus 1) of reach, set item (spot plus 1) of reach to raised. Expand from spot minus 1.\n\nSet item 0 of reach to 10.\nFor every station from 0 to 3.\nExpand from station.\n\nThe answer is -1.\nFor every stops from 0 to 4.\nIf item stops of reach is at least 100 and answer is -1, set answer to stops.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":872,"slug":"leaf-similar-trees","title":"Leaf-Similar Trees","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 3, 5, 1, 6, 2, 9, 8, -1, -1, 7, and 4. Keep a shared lefts holding 1, 3, 5, -1, 9, -1, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, 10, -1, -1, -1, -1, -1, and -1. Keep a shared secondvalues holding 3, 5, 1, 6, 7, 4, 2, -1, -1, -1, -1, -1, -1, 9, and 8. Keep a shared secondlefts holding 1, 3, 5, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, and -1. Keep a shared secondrights holding 2, 4, 6, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, and -1. Keep a shared firstleaves as an empty list of whole numbers. Keep a shared otherleaves as an empty list of whole numbers.\nTo gather first from node (a whole number). If node is less than 0, return. If item node of lefts is less than 0 and item node of rights is less than 0, Place item node of values into firstleaves, return. Gather first from item node of lefts. Gather first from item node of rights.\n\nTo gather other from node (a whole number). If node is less than 0, return. If item node of secondlefts is less than 0 and item node of secondrights is less than 0, Place item node of secondvalues into otherleaves, return. Gather other from item node of secondlefts. Gather other from item node of secondrights.\n\nGather first from 0. Gather other from 0. The same is 1. The firstcount is the number of items in firstleaves. The othercount is the number of items in otherleaves. If firstcount is not othercount, set same to 0.\nFor every spot from 0 to the last position of firstleaves.\nIf item spot of firstleaves is not item spot of otherleaves, set same to 0.\n\nIf same is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":873,"slug":"length-of-longest-fibonacci-subsequence","title":"Length of Longest Fibonacci Subsequence","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 2, 3, 4, 5, 6, 7, and 8. Keep a shared located of -1. Keep a shared best of 0. Keep a shared tally of 2.\nTo locate from goal (a whole number) with spot (a whole number). If spot is more than the last position of numbers, return. If item spot of numbers is goal, set located to spot, return. Locate from goal with spot plus 1.\n\nTo collect from first (a whole number) with second (a whole number). If tally is more than best, set best to tally. The wanted is item first of numbers plus item second of numbers. Set located to -1. Locate from wanted with second plus 1. If located is at least 0, set tally to tally plus 1, Collect from second with located.\n\nThe last is the last position of numbers.\nFor every first from 0 to last.\nFor every second from first plus 1 to last.\nSet tally to 2. Collect from first with second.\n\nIf best is less than 3, set best to 0. Show best.\n","expected":"5\n","step_budget":2000000},{"id":874,"slug":"walking-robot-simulation","title":"Walking Robot Simulation","difficulty":"Medium","category":"Array","code":"Keep a shared stepx holding 0, 1, 0, and -1. Keep a shared stepy holding 1, 0, -1, and 0. Keep a shared barrierx as an empty list of whole numbers. Keep a shared barriery as an empty list of whole numbers. Keep a shared east of 0. Keep a shared north of 0. Keep a shared dir of 0. Keep a shared best of 0. Keep a shared probex of 0. Keep a shared probey of 0. Keep a shared blocked of 0.\nTo obstruct from spot (a whole number). If spot is more than the last position of barrierx, return. If item spot of barrierx is probex and item spot of barriery is probey, set blocked to 1, return. Obstruct from spot plus 1.\n\nTo advance from remaining (a whole number). If remaining is 0, return. The way is dir. The nextx is east plus item way of stepx. The nexty is north plus item way of stepy. Set probex to nextx. Set probey to nexty. Set blocked to 0. Obstruct from 0. If blocked is 1, return. Set east to nextx. Set north to nexty. The reach is east times east plus north times north. If reach is more than best, set best to reach. Advance from remaining minus 1.\n\nThe commands is a list of 4, -1, and 3.\nFor each command in commands.\nIf command is equal to -1, set dir to dir plus 1 modulo 4. If command is equal to -2, set dir to dir plus 3 modulo 4. If command is more than 0, Advance from command.\n\nShow best.\n","expected":"25\n","step_budget":2000000},{"id":875,"slug":"koko-eating-bananas","title":"Koko Eating Bananas","difficulty":"Medium","category":"Array","code":"Keep a shared piles holding 3, 6, 7, and 11. Keep a shared hours of 0.\nTo count from spot (a whole number) with speed (a whole number). If spot is more than the last position of piles, return. The pile is item spot of piles. The needed is (pile plus speed minus 1) divided by speed. Add needed to hours. Count from spot plus 1 with speed.\n\nThe limit is 8. The low is 1. The high is 11. The answer is 11.\nRepeat while low is at most high.\nThe middle is the midpoint of low and high. Set hours to 0. Count from 0 with middle. If hours is at most limit, set answer to middle, set high to middle minus 1, otherwise set low to middle plus 1.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":876,"slug":"middle-of-the-linked-list","title":"Middle of the Linked List","difficulty":"Easy","category":"Two Pointers","code":"The values is a list of 1, 2, 3, 4, and 5. The last is the last position of values. The middle is 0. The fast is 0.\nRepeat while fast is less than last.\nIncrease fast by 2. Add 1 to middle.\n\nFor every spot from middle to last.\nShow item spot of values.\n","expected":"3\n4\n5\n","step_budget":2000000},{"id":877,"slug":"stone-game","title":"Stone Game","difficulty":"Medium","category":"Array","code":"The piles is a list of 5, 3, 4, and 5. The size is 4. The table is a list of 16 zeros.\nFor every span from 1 to size.\nFor every start from 0 to size minus span.\nThe finish is start plus span minus 1. If start is finish, set item (start times size plus start) of table to item start of piles.\nIf start is not finish.\nThe leftindex is (start plus 1) times size plus finish. The rightindex is start times size plus finish minus 1. The left is item start of piles minus item leftindex of table. The right is item finish of piles minus item rightindex of table. If left is more than right, set item (start times size plus finish) of table to left, otherwise set item (start times size plus finish) of table to right.\n\nThe outcome is item (size minus 1) of table. If outcome is at least 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":878,"slug":"nth-magical-number","title":"Nth Magical Number","difficulty":"Hard","category":"Math","code":"Keep a shared first of 0. Keep a shared second of 0. Keep a shared rank of 0. Keep a shared leftvalue of 0. Keep a shared rightvalue of 0. Keep a shared divisor of 0. Keep a shared multiple of 0. Keep a shared counted of 0. Keep a shared answer of 0. Set first to 2. Set second to 3. Set rank to 4.\nTo reduce. If rightvalue is 0, set divisor to leftvalue, return. The remainder is leftvalue modulo rightvalue. Set leftvalue to rightvalue. Set rightvalue to remainder. Reduce.\n\nTo tally with spot (a whole number). Set counted to spot divided by first plus spot divided by second minus spot divided by multiple.\n\nTo seek from low (a whole number) with high (a whole number). If low is at least high, set answer to low, return. The middle is (low plus high) divided by 2. Tally with middle. If counted is at least rank, seek from low with middle, return. If counted is less than rank, seek from middle plus 1 with high.\n\nSet leftvalue to first. Set rightvalue to second. Reduce. Set multiple to first divided by divisor times second. Seek from 1 with first times rank. Show answer.\n","expected":"6\n","step_budget":2000000},{"id":879,"slug":"profitable-schemes","title":"Profitable Schemes","difficulty":"Hard","category":"Array","code":"The members is a list of 2, 3, and 5. The gains is a list of 6, 7, and 8. The people is 10. The target is 5. The width is target plus 1. The rows is (people plus 1) times width. The table is a list of 264 zeros. Set item 0 of table to 1.\nFor every crime from 0 to 2.\nThe cost is item crime of members. The gain is item crime of gains.\nFor every used from 0 to people.\nFor every earned from 0 to target.\nThe here is crime times rows plus used times width plus earned. The next is here plus rows. Increase item next of table by item here of table.\nIf used plus cost is at most people.\nThe reached is earned plus gain. If reached is more than target, set reached to target. The moved is next plus cost times width plus reached minus earned. Increase item moved of table by item here of table.\n\nThe total is 0.\nFor every used from 0 to people.\nIncrease total by item (3 times rows plus used times width plus target) of table.\n\nShow total.\n","expected":"7\n","step_budget":2000000},{"id":880,"slug":"decoded-string-at-index","title":"Decoded String at Index","difficulty":"Medium","category":"String","code":"The source is \"leet2code3\". The rank is 10. The last is the last position of source. The size is 0. The amount is 0.\nFor every spot from 0 to last.\nThe symbol is character spot of source. Set amount to the digit value of symbol. If symbol is between \"0\" and \"9\", set size to size times amount. If symbol is not between \"0\" and \"9\", add 1 to size. If size is more than rank, set size to rank.\n\nThe answer is empty text. The place is last.\nRepeat while place is at least 0.\nSet symbol to character place of source. Set amount to the digit value of symbol. If symbol is between \"0\" and \"9\", set size to size divided by amount. If symbol is between \"0\" and \"9\", set rank to rank minus 1. If symbol is between \"0\" and \"9\", set rank to rank modulo size. If symbol is between \"0\" and \"9\", add 1 to rank. If symbol is not between \"0\" and \"9\" and rank is size, set answer to the slice of source from place to place plus 1, stop. If symbol is not between \"0\" and \"9\", subtract 1 from size. Subtract 1 from place.\n\nShow answer.\n","expected":"o\n","step_budget":2000000},{"id":881,"slug":"boats-to-save-people","title":"Boats to Save People","difficulty":"Medium","category":"Array","code":"The people is a list of 3, 2, 2, and 1. The limit is 3. Sort people. The low is 0. The high is the last position of people. The boats is 0.\nRepeat while low is at most high.\nIf low is high, add 1 to boats, set low to low plus 1, set high to high minus 1.\nIf low is less than high.\nThe pair is item low of people plus item high of people. If pair is at most limit, add 1 to low. Decrease high by 1. Add 1 to boats.\n\nShow boats.\n","expected":"3\n","step_budget":2000000},{"id":882,"slug":"reachable-nodes-in-subdivided-graph","title":"Reachable Nodes In Subdivided Graph","difficulty":"Hard","category":"Graph Theory","code":"Keep a shared starts holding 0, 0, and 1. Keep a shared ends holding 1, 2, and 2. Keep a shared weights holding 10, 1, and 2. Keep a shared distances holding 0, 1000000, and 1000000. Keep a shared visited holding 0, 0, and 0. Keep a shared chosen of 0. Keep a shared closest of 0. Keep a shared partner of 0. Keep a shared candidate of 0.\nTo choose. Set chosen to -1. Set closest to 1000000.\nFor every node from 0 to 2.\nIf item node of visited is 0 and item node of distances is less than closest, set chosen to node, set closest to item node of distances.\n\nTo relax. The settled is chosen.\nFor every edge from 0 to 2.\nSet partner to -1. If item edge of starts is settled, set partner to item edge of ends. If item edge of ends is settled, set partner to item edge of starts. Set candidate to item settled of distances plus item edge of weights plus 1. The target is partner. If target is at least 0 and candidate is less than item target of distances, set item target of distances to candidate.\n\nFor every round from 1 to 3.\nChoose. The here is chosen. If here is at least 0, set item here of visited to 1. Relax.\n\nThe total is 3.\nFor every edge from 0 to 2.\nThe start is item edge of starts. The finish is item edge of ends. The startroom is 6 minus item start of distances. The finishroom is 6 minus item finish of distances. If startroom is less than 0, set startroom to 0. If finishroom is less than 0, set finishroom to 0. The share is startroom plus finishroom. If share is more than item edge of weights, set share to item edge of weights. Increase total by share.\n\nShow total.\n","expected":"13\n","step_budget":2000000},{"id":883,"slug":"projection-area-of-3d-shapes","title":"Projection Area of 3D Shapes","difficulty":"Easy","category":"Array","code":"The grid is a list of 1, 2, 3, and 4. The height is 2. The width is 2. The top is 0. The front is 0. The side is 0.\nFor every line from 0 to height minus 1.\nThe rowbest is 0.\nFor every column from 0 to width minus 1.\nThe amount is item (line times width plus column) of grid. If amount is more than 0, add 1 to top. If amount is more than rowbest, set rowbest to amount. If column is width minus 1, add rowbest to front.\n\nFor every column from 0 to width minus 1.\nThe columnbest is 0.\nFor every line from 0 to height minus 1.\nThe amount is item (line times width plus column) of grid. If amount is more than columnbest, set columnbest to amount. If line is height minus 1, add columnbest to side.\n\nThe area is top plus front plus side. Show area.\n","expected":"17\n","step_budget":2000000},{"id":884,"slug":"uncommon-words-from-two-sentences","title":"Uncommon Words from Two Sentences","difficulty":"Easy","category":"String","code":"The first is \"this apple is sweet\". The second is \"this apple is sour\". The firstwords is split first by \" \". The secondwords is split second by \" \". Keep a shared vocabulary as an empty list of text. Keep a shared counts as an empty list of whole numbers. Keep a shared sought as empty text. Keep a shared foundat of 0.\nTo find from spot (a whole number). If spot is more than the last position of vocabulary, set foundat to -1, return. If item spot of vocabulary matches sought, set foundat to spot, return. Find from spot plus 1.\n\nTo record. Set foundat to -1. Find from 0. The local is foundat. If local is at least 0, set item local of counts to item local of counts plus 1, return. The fresh is a copy of sought. Place fresh into vocabulary. Place 1 into counts.\n\nFor each piece in firstwords.\nSet sought to piece. Record.\n\nFor each piece in secondwords.\nSet sought to piece. Record.\n\nFor every spot from 0 to the last position of vocabulary.\nIf item spot of counts is 1, show item spot of vocabulary.\n","expected":"sweet\nsour\n","step_budget":2000000},{"id":885,"slug":"spiral-matrix-iii","title":"Spiral Matrix III","difficulty":"Medium","category":"Array","code":"The rows is 5. The columns is 6. The total is rows times columns. Keep a shared answers as an empty list of text. Keep a shared found of 0. Keep a shared label as empty text. Keep a shared line of 0. Keep a shared column of 0. Set line to 1. Set column to 4.\nTo record. The linetext is format whole number line as text. Set label to linetext. Place \",\" into label. The columntext is format whole number column as text. Place columntext into label. The copy is a copy of label. Place copy into answers. Add 1 to found.\n\nRecord. The runleft is 0. The legs is 0. The heading is 0.\nRepeat while found is less than total.\nIf runleft is 0, add 1 to legs, set runleft to (legs plus 1) divided by 2, set heading to (legs minus 1) modulo 4. If heading is 0, add 1 to column. If heading is 1, add 1 to line. If heading is 2, subtract 1 from column. If heading is 3, subtract 1 from line. If line is at least 0 and line is less than rows and column is at least 0 and column is less than columns, record. Subtract 1 from runleft.\n\nFor each entry in answers, show entry.\n","expected":"1,4\n1,5\n2,5\n2,4\n2,3\n1,3\n0,3\n0,4\n0,5\n3,5\n3,4\n3,3\n3,2\n2,2\n1,2\n0,2\n4,5\n4,4\n4,3\n4,2\n4,1\n3,1\n2,1\n1,1\n0,1\n4,0\n3,0\n2,0\n1,0\n0,0\n","step_budget":2000000},{"id":886,"slug":"possible-bipartition","title":"Possible Bipartition","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared people of 0. Keep a shared width of 0. Keep a shared edges as an empty list of whole numbers. Keep a shared colors as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared head of 0. Keep a shared sound of 1. Set people to 4. Set width to people plus 1.\nFor every cell from 0 to 24.\nPlace 0 into edges.\n\nThe pairs is a list of 1, 2, 1, 3, 2, and 4.\nFor every pair from 0 to 2.\nThe left is item (pair times 2) of pairs. The right is item (pair times 2 plus 1) of pairs. Set item (left times width plus right) of edges to 1. Set item (right times width plus left) of edges to 1.\n\nFor every tone from 0 to 4.\nPlace 0 into colors.\n\nTo paint from start (a whole number). Set head to 0. Place start into queue.\nRepeat while head is at most the last position of queue.\nThe atspot is head. The person is item atspot of queue. Add 1 to head.\nFor every other from 1 to people.\nIf item (person times width plus other) of edges is 1 and item other of colors is 0, set item other of colors to 3 minus item person of colors, Place other into queue. If item (person times width plus other) of edges is 1 and item other of colors is item person of colors, set sound to 0.\n\nSet item 1 of colors to 1. Paint from 1. If item 2 of colors is 0, set item 2 of colors to 1, paint from 2. If item 3 of colors is 0, set item 3 of colors to 1, paint from 3. If item 4 of colors is 0, set item 4 of colors to 1, paint from 4. If sound is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":887,"slug":"super-egg-drop","title":"Super Egg Drop","difficulty":"Hard","category":"Math","code":"The eggs is 2. The floors is 6. The width is floors plus 1. The ways is a list of 21 zeros.\nFor every count from 1 to eggs.\nFor every move from 1 to floors.\nThe above is item ((count minus 1) times width plus move minus 1) of ways. The below is item (count times width plus move minus 1) of ways. The total is above plus below plus 1. Set item (count times width plus move) of ways to total.\n\nThe moves is 0. The reached is 0.\nRepeat while reached is less than floors.\nAdd 1 to moves. Set reached to item (eggs times width plus moves) of ways.\n\nShow moves.\n","expected":"3\n","step_budget":2000000},{"id":888,"slug":"fair-candy-swap","title":"Fair Candy Swap","difficulty":"Easy","category":"Array","code":"The alice is a list of 1 and 1, while the bob is a list of 2 and 2. The alice total is 0, while the bob total is 0. For each treat in alice, add treat to alice total. For each sweet in bob, add sweet to bob total. The first is 0, while the second is 0. The found is 0.\nFor each treat in alice.\nFor each sweet in bob.\nIf found is 0 and alice total minus treat plus sweet is bob total plus treat minus sweet, set first to treat, set second to sweet, set found to 1. If found is 1, stop.\n\nShow first. Show second.\n","expected":"1\n2\n","step_budget":2000000},{"id":889,"slug":"construct-binary-tree-from-preorder-and-postorder-traversal","title":"Construct Binary Tree from Preorder and Postorder Traversal","difficulty":"Medium","category":"Array","code":"Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared built of 0. Keep a shared nextslot of 0. Keep a shared preindex of 0. Keep a shared postindex of 0. Keep a shared preorder as an empty list of whole numbers. Keep a shared postorder as an empty list of whole numbers. Place 1 into preorder. Place 2 into preorder. Place 4 into preorder. Place 5 into preorder. Place 3 into preorder. Place 6 into preorder. Place 7 into preorder. Place 4 into postorder. Place 5 into postorder. Place 2 into postorder. Place 6 into postorder. Place 7 into postorder. Place 3 into postorder. Place 1 into postorder.\n\nTo build. The slot is nextslot. Add 1 to nextslot. The prelocal is preindex. The here is item prelocal of preorder. Add 1 to preindex. Place here into values. Place -1 into lefts. Place -1 into rights. Set built to slot. The postlocal is postindex. If here is item postlocal of postorder, add 1 to postindex, then return. Build. Set item slot of lefts to built. The postlocal is postindex. If here is item postlocal of postorder, add 1 to postindex, then return. Build. Set item slot of rights to built. Add 1 to postindex. Set built to slot.\n\nBuild. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0, while the count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Show item node of values. The left is item node of lefts. The right is item node of rights. If left is at least 0, Place left into queue, add 1 to count. If right is at least 0, Place right into queue, add 1 to count.\n","expected":"1\n2\n3\n4\n5\n6\n7\n","step_budget":2000000},{"id":890,"slug":"find-and-replace-pattern","title":"Find and Replace Pattern","difficulty":"Medium","category":"Array","code":"The pattern is \"abb\". The words is a list of \"abc\", \"deq\", \"mee\", \"aqq\", \"dkd\", and \"ccc\". The answers is an empty list of text.\nFor each word in words.\nThe last is the last position of word. The okay is 1.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nThe patternleft is the slice of pattern from left to left plus 1. The patternright is the slice of pattern from right to right plus 1. The wordleft is the slice of word from left to left plus 1. The wordright is the slice of word from right to right plus 1. The patternsame is 0, while the wordsame is 0. If patternleft matches patternright, set patternsame to 1. If wordleft matches wordright, set wordsame to 1. If patternsame is not wordsame, set okay to 0. If left is last minus 1 and right is last and okay is 1, Place word into answers.\n\nFor each answer in answers, show answer.\n","expected":"mee\naqq\n","step_budget":2000000},{"id":891,"slug":"sum-of-subsequence-widths","title":"Sum of Subsequence Widths","difficulty":"Hard","category":"Array","code":"The numbers is a list of 5, 4, 3, 2, and 1. Sort numbers. The last is the last position of numbers. The powers is an empty list of whole numbers. Place 1 into powers.\nFor every step from 0 to last minus 1.\nThe tail is item step of powers. The next is (tail times 2) modulo 1000000007. Place next into powers.\n\nThe total is 0.\nFor every spot from 0 to last.\nThe leftpower is item spot of powers. The mirror is last minus spot. The rightpower is item mirror of powers. The gap is leftpower minus rightpower. If gap is less than 0, add 1000000007 to gap. The value is item spot of numbers. The term is (value times gap) modulo 1000000007. Add term to total. Set total to total modulo 1000000007.\n\nShow total.\n","expected":"72\n","step_budget":2000000},{"id":892,"slug":"surface-area-of-3d-shapes","title":"Surface Area of 3D Shapes","difficulty":"Easy","category":"Array","code":"The shape is a list of 1, 2, 3, and 4. The lines is 2, while the columns is 2. The lastline is lines minus 1, while the lastcolumn is columns minus 1. The area is 0.\nFor every line from 0 to lastline.\nFor every column from 0 to lastcolumn.\nThe cell is line times columns plus column. The height is item cell of shape. If height is more than 0, add 2 to area, add height times 4 to area. If column is less than lastcolumn, The rightheight is item (cell plus 1) of shape, The shared is the smaller of height and rightheight, subtract shared times 2 from area. If line is less than lastline, The downheight is item (cell plus columns) of shape, The shared is the smaller of height and downheight, subtract shared times 2 from area.\n\nShow area.\n","expected":"34\n","step_budget":2000000},{"id":893,"slug":"groups-of-special-equivalent-strings","title":"Groups of Special-Equivalent Strings","difficulty":"Medium","category":"Array","code":"The words is a list of \"abcd\", \"cdab\", \"cbad\", \"xyzz\", \"zzxy\", and \"zzyx\". The signatures is an empty list of text. The groups is 0.\nFor each word in words.\nThe last is the last position of word. The evenletters is empty text, while the oddletters is empty text.\nFor every spot from 0 to last.\nThe piece is the slice of word from spot to spot plus 1. If spot modulo 2 is 0, Place piece into evenletters. If spot modulo 2 is 1, Place piece into oddletters. The sortedeven is sort characters of evenletters. The sortedodd is sort characters of oddletters. The signature is empty text. Place sortedeven into signature. Place \"|\" into signature. Place sortedodd into signature. The known is 0. For each saved in signatures, if saved matches signature, set known to 1. If spot is last and known is 0, Place signature into signatures, add 1 to groups.\n\nShow groups.\n","expected":"3\n","step_budget":2000000},{"id":894,"slug":"all-possible-full-binary-trees","title":"All Possible Full Binary Trees","difficulty":"Medium","category":"Dynamic Programming","code":"The wanted is 7. The shapes is an empty list of text. The starts is a list of 8 zeros. The counts is a list of 8 zeros. Place \"()\" into shapes. Set item 1 of counts to 1. The slot is 1.\nFor every size from 3 to wanted by 2.\nSet item size of starts to slot. The leftsize is 1.\nRepeat while leftsize is less than size.\nThe rightsize is size minus 1 minus leftsize. The leftbegin is item leftsize of starts. The leftcount is item leftsize of counts. The rightbegin is item rightsize of starts. The rightcount is item rightsize of counts. The leftend is leftbegin plus leftcount minus 1. The rightend is rightbegin plus rightcount minus 1.\nFor every leftspot from leftbegin to leftend.\nFor every rightspot from rightbegin to rightend.\nThe leftshape is item leftspot of shapes. The rightshape is item rightspot of shapes. The shape is empty text. Place \"(\" into shape. Place leftshape into shape. Place rightshape into shape. Place \")\" into shape. Place shape into shapes. Increase item size of counts by 1. Add 1 to slot. If leftspot is leftend and rightspot is rightend, add 2 to leftsize.\n\nShow item wanted of counts. The first is item wanted of starts. The last is the last position of shapes.\nFor every spot from first to last.\nShow item spot of shapes.\n","expected":"5\n(()(()(()())))\n(()((()())()))\n((()())(()()))\n((()(()()))())\n(((()())())())\n","step_budget":2000000},{"id":896,"slug":"monotonic-array","title":"Monotonic Array","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 2, 2, and 3. The last is the last position of numbers. The rising is 1, while the falling is 1.\nFor every spot from 1 to last.\nThe before is item (spot minus 1) of numbers. The here is item spot of numbers. If before is more than here, set rising to 0. If before is less than here, set falling to 0.\n\nIf rising is 1 or falling is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":897,"slug":"increasing-order-search-tree","title":"Increasing Order Search Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared order as an empty list of whole numbers. Place 5 into values. Place 3 into values. Place 6 into values. Place 2 into values. Place 4 into values. Place 8 into values. Place 1 into values. Place 7 into values. Place 9 into values. Place 1 into lefts. Place 3 into lefts. Place -1 into lefts. Place 6 into lefts. Place -1 into lefts. Place 7 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place 2 into rights. Place 4 into rights. Place 5 into rights. Place -1 into rights. Place -1 into rights. Place 8 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights.\n\nTo gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Place item node of values into order. Gather from item node of rights.\n\nGather from 0. The last is the last position of order. The final is item last of order. The pieces is an empty list of text.\nFor each value in order.\nThe piece is format whole number value as text. Place piece into pieces. If value is not final, Place \"null\" into pieces.\n\nThe line is join pieces with \",\". Show line.\n","expected":"1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9\n","step_budget":2000000},{"id":898,"slug":"bitwise-ors-of-subarrays","title":"Bitwise ORs of Subarrays","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 1, and 2. The last is the last position of numbers. The seen is an empty list of whole numbers.\nFor every start from 0 to last.\nThe running is 0.\nFor every finish from start to last.\nThe value is item finish of numbers. Set running to bitwise or of running and value. If seen does not contain running, Place running into seen.\n\nShow the number of items in seen.\n","expected":"3\n","step_budget":2000000},{"id":899,"slug":"orderly-queue","title":"Orderly Queue","difficulty":"Hard","category":"String","code":"The word is \"cba\". The turns is 1. The last is the last position of word. The best is a copy of word. The current is a copy of word.\nIf turns is 1.\nFor every step from 0 to last.\nIf current comes before best, set best to current. The first is the slice of current from 0 to 1. The rest is the slice of current from 1 to last plus 1. The moved is empty text. Place rest into moved. Place first into moved. Set current to moved.\n\nIf turns is more than 1, The sorted is sort characters of word, show sorted. If turns is 1, show best.\n","expected":"acb\n","step_budget":2000000},{"id":902,"slug":"numbers-at-most-n-given-digit-set","title":"Numbers At Most N Given Digit Set","difficulty":"Hard","category":"Array","code":"Keep a shared digits holding 1, 3, 5, and 7. Keep a shared counter of 0. The limit is 100.\nTo screen from value (a whole number). Set counter to 1. The rest is value.\nRepeat while rest is more than 0.\nThe digit is rest modulo 10. If digits contains digit, set rest to rest divided by 10, otherwise set counter to 0, set rest to 0.\n\nThe total is 0.\nFor every value from 1 to limit.\nScreen from value. If counter is 1, add 1 to total.\n\nShow total.\n","expected":"20\n","step_budget":2000000},{"id":903,"slug":"valid-permutations-for-di-sequence","title":"Valid Permutations for DI Sequence","difficulty":"Hard","category":"String","code":"Keep a shared pattern as empty text. Place \"DID\" into pattern. Keep a shared size of 4. Keep a shared used holding 0, 0, 0, 0, and 0. Keep a shared picks as an empty list of whole numbers. Keep a shared good of 0. Keep a shared total of 0.\nTo validate. Set good to 1. The last is the last position of pattern.\nFor every spot from 0 to last.\nThe belowpick is item spot of picks. The abovepick is item (spot plus 1) of picks. The symbol is character spot of pattern. If symbol is \"I\" and belowpick is more than abovepick, set good to 0. If symbol is \"D\" and belowpick is less than abovepick, set good to 0.\n\nTo finish. Validate. If good is 1, add 1 to total.\n\nTo arrange from spot (a whole number). If spot is at least size, finish.\nFor every choice from 1 to size.\nIf item choice of used is 0, set item choice of used to 1, Place choice into picks, Arrange from spot plus 1, remove the last item from picks, set item choice of used to 0.\n\nArrange from 0. Show total.\n","expected":"5\n","step_budget":2000000},{"id":904,"slug":"fruit-into-baskets","title":"Fruit Into Baskets","difficulty":"Medium","category":"Array","code":"The fruits is a list of 1, 2, 3, 2, and 2. The lastfruit is -1. The priorfruit is -1. The lastcount is 0. The priorcount is 0. The held is 0. The best is 0.\nFor each fruit in fruits.\nIf fruit is lastfruit, add 1 to lastcount. If fruit is priorfruit, set held to lastcount, set lastcount to priorcount plus 1, set priorcount to held, set priorfruit to lastfruit, set lastfruit to fruit. If fruit is not lastfruit and fruit is not priorfruit, set priorfruit to lastfruit, set priorcount to lastcount, set lastfruit to fruit, set lastcount to 1. The span is lastcount plus priorcount. If span is more than best, set best to span.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":905,"slug":"sort-array-by-parity","title":"Sort Array By Parity","difficulty":"Easy","category":"Array","code":"The numbers is a list of 3, 1, 2, and 4. The ordered is an empty list of whole numbers.\nFor each value in numbers.\nIf value modulo 2 is 0, Place value into ordered.\n\nFor each value in numbers.\nIf value modulo 2 is not 0, Place value into ordered.\n\nFor each value in ordered, show value.\n","expected":"2\n4\n3\n1\n","step_budget":2000000},{"id":906,"slug":"super-palindromes","title":"Super Palindromes","difficulty":"Hard","category":"String","code":"Keep a shared reflection of 0. Keep a shared root of 0. Keep a shared total of 0. Keep a shared mirrorvalue of 0. The low is 4. The high is 1000.\nTo reverse from remaining (a whole number) with built (a whole number). If remaining is less than 1 and built is not mirrorvalue, set reflection to 0, return. If remaining is less than 1, return. The digit is remaining modulo 10. Reverse from remaining divided by 10 with built times 10 plus digit.\n\nTo mirror from value (a whole number). Set mirrorvalue to value. Set reflection to 1. Reverse from value with 0.\n\nTo seek from value (a whole number). Set root to 0.\nRepeat while root times root is less than value.\nAdd 1 to root.\n\nTo inspect from value (a whole number). Mirror from value. If reflection is 0, return. Seek from value. If root times root is value and root is more than 0, Mirror from root, if reflection is 1, add 1 to total.\n\nFor every value from low to high.\nInspect from value.\n\nShow total.\n","expected":"4\n","step_budget":2000000},{"id":907,"slug":"sum-of-subarray-minimums","title":"Sum of Subarray Minimums","difficulty":"Medium","category":"Array","code":"The numbers is a list of 3, 1, 2, and 4. The last is the last position of numbers. The total is 0.\nFor every start from 0 to last.\nThe lowest is item start of numbers.\nFor every finish from start to last.\nIf item finish of numbers is less than lowest, set lowest to item finish of numbers. Increase total by lowest.\n\nShow total.\n","expected":"17\n","step_budget":2000000},{"id":908,"slug":"smallest-range-i","title":"Smallest Range I","difficulty":"Easy","category":"Array","code":"The numbers is a list of 0 and 10. The slack is 2. The last is the last position of numbers. The lowest is item 0 of numbers. The highest is item 0 of numbers.\nFor every spot from 1 to last.\nIf item spot of numbers is less than lowest, set lowest to item spot of numbers. If item spot of numbers is more than highest, set highest to item spot of numbers.\n\nThe spread is highest minus lowest. Decrease spread by 2 times slack. If spread is less than 0, set spread to 0. Show spread.\n","expected":"6\n","step_budget":2000000},{"id":909,"slug":"snakes-and-ladders","title":"Snakes and Ladders","difficulty":"Medium","category":"Array","code":"The jumps is a list of -1, -1, -1, 9, -1, -1, -1, -1, -1, and -1. The visited is a list of 10 zeros. The distance is a list of 10 zeros. The queue is an empty list of whole numbers. Set item 1 of visited to 1. Place 1 into queue. The head is 0. The count is 1. The target is 9.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head.\nFor every roll from 1 to 6.\nThe landing is node plus roll.\nIf landing is at most target.\nThe jump is item landing of jumps. If jump is not -1, set landing to jump. If item landing of visited is 0, set item landing of visited to 1, set item landing of distance to item node of distance plus 1, Place landing into queue, add 1 to count.\n\nShow item target of distance.\n","expected":"1\n","step_budget":2000000},{"id":910,"slug":"smallest-range-ii","title":"Smallest Range II","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 3, and 6. The slack is 3. Sort numbers. The last is the last position of numbers. The best is item last of numbers minus item 0 of numbers.\nFor every spot from 0 to last minus 1.\nThe low is item 0 of numbers plus slack. The high is item last of numbers minus slack. If item (spot plus 1) of numbers minus slack is less than low, set low to item (spot plus 1) of numbers minus slack. If item spot of numbers plus slack is more than high, set high to item spot of numbers plus slack. The spread is high minus low. If spread is less than best, set best to spread.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":912,"slug":"sort-an-array","title":"Sort an Array","difficulty":"Medium","category":"Array","code":"The numbers is a list of 5, 2, 3, and 1. The last is the last position of numbers.\nFor every spot from 0 to last.\nFor every look from spot plus 1 to last.\nIf item look of numbers is less than item spot of numbers, swap item spot of numbers and item look of numbers.\n\nFor each value in numbers, show value.\n","expected":"1\n2\n3\n5\n","step_budget":2000000},{"id":913,"slug":"cat-and-mouse","title":"Cat and Mouse","difficulty":"Hard","category":"Math","code":"Keep a shared edges holding 1, 3, 0, 3, 0, and 2. Keep a shared starts holding 0, 2, 3, and 4. Keep a shared counts holding 2, 1, 1, and 2. Keep a shared catdegrees holding 0, 0, 0, and 0. Keep a shared colors as an empty list of whole numbers.\nFor every spot from 0 to 31.\nPlace 0 into colors.\n\nKeep a shared remaining as an empty list of whole numbers.\nFor every spot from 0 to 31.\nPlace 0 into remaining.\n\nKeep a shared queue as an empty list of whole numbers. Keep a shared count of 0. Keep a shared champion of 0. Keep a shared nowmouse of 0. Keep a shared nowcat of 0. Keep a shared nowturn of 0.\nTo relax from pred (a whole number) with winner (a whole number). If item pred of colors is not 0, return. The actor is pred modulo 2. If actor is 0 and winner is 1, set item pred of colors to winner, Place pred into queue, add 1 to count, return. If actor is 1 and winner is 2, set item pred of colors to winner, Place pred into queue, add 1 to count, return. Decrease item pred of remaining by 1. If item pred of remaining is 0, set item pred of colors to winner, Place pred into queue, add 1 to count.\n\nTo catparents from mouse (a whole number) with cat (a whole number) and winner (a whole number). The begin is item cat of starts. The total is item cat of counts.\nFor every slot from begin to begin plus total minus 1.\nThe step is item slot of edges.\nIf step is not 0.\nThe pred is (mouse times 4 plus step) times 2 plus 1. Relax from pred with winner.\n\nTo mouseparents from mouse (a whole number) with cat (a whole number) and winner (a whole number). The begin is item mouse of starts. The total is item mouse of counts.\nFor every slot from begin to begin plus total minus 1.\nThe step is item slot of edges.\nIf step is not 0 and step is not cat.\nThe pred is (step times 4 plus cat) times 2. Relax from pred with winner.\n\nFor every cat from 1 to 3.\nThe begin is item cat of starts. The total is item cat of counts.\nFor every slot from begin to begin plus total minus 1.\nIf item slot of edges is not 0, set item cat of catdegrees to item cat of catdegrees plus 1.\n\nFor every mouse from 0 to 3.\nFor every cat from 0 to 3.\nFor every turn from 0 to 1.\nIf mouse is 0, The index is (mouse times 4 plus cat) times 2 plus turn, set item index of colors to 1, Place index into queue, add 1 to count.\n\nFor every mouse from 0 to 3.\nFor every cat from 0 to 3.\nFor every turn from 0 to 1.\nIf mouse is more than 0 and mouse is cat, The index is (mouse times 4 plus cat) times 2 plus turn, set item index of colors to 2, Place index into queue, add 1 to count.\n\nFor every mouse from 1 to 3.\nFor every cat from 0 to 3.\nFor every turn from 0 to 1.\nIf mouse is not cat and cat is not 0.\nThe index is (mouse times 4 plus cat) times 2 plus turn. If turn is 0, set item index of remaining to item mouse of counts. If turn is 1, set item index of remaining to item cat of catdegrees.\n\nThe head is 0.\nRepeat while head is less than count.\nThe state is item head of queue. Add 1 to head. Set champion to item state of colors. Set nowmouse to state divided by 8. The rest is state modulo 8. Set nowcat to rest divided by 2. Set nowturn to rest modulo 2. If nowturn is 0, Catparents from nowmouse with nowcat and champion. If nowturn is 1, Mouseparents from nowmouse with nowcat and champion.\n\nThe start is (1 times 4 plus 2) times 2. Show item start of colors.\n","expected":"1\n","step_budget":2000000},{"id":914,"slug":"x-of-a-kind-in-a-deck-of-cards","title":"X of a Kind in a Deck of Cards","difficulty":"Easy","category":"Array","code":"The deck is a list of 1, 2, 3, 4, 4, 3, 2, and 1. The counts is a list of 5 zeros.\nFor each card in deck.\nIncrease item card of counts by 1.\n\nKeep a shared answer of 0.\nTo gather from left (a whole number) with right (a whole number). If right is 0, set answer to left, return. Gather from right with left modulo right.\n\nFor every rank from 0 to 4.\nIf item rank of counts is more than 0.\nThe amount is item rank of counts. If answer is 0, set answer to amount. If answer is more than 0, Gather from answer with amount.\n\nIf answer is at least 2, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":915,"slug":"partition-array-into-disjoint-intervals","title":"Partition Array into Disjoint Intervals","difficulty":"Medium","category":"Array","code":"The values is a list of 5, 0, 3, 8, and 6. The size is the number of items in values. The last is the last position of values. The ceilings is a list of size zeros. Set item 0 of ceilings to item 0 of values.\nFor every spot from 1 to last.\nThe prior is item (spot minus 1) of ceilings. If prior is more than item spot of values, set item spot of ceilings to prior, otherwise set item spot of ceilings to item spot of values.\n\nThe floors is a list of size zeros. Set item last of floors to item last of values.\nFor every step from 1 to last.\nThe spot is last minus step. The after is item (spot plus 1) of floors. If after is less than item spot of values, set item spot of floors to after, otherwise set item spot of floors to item spot of values.\n\nThe boundary is 0.\nFor every spot from 0 to last minus 1.\nThe upper is item spot of ceilings. The lower is item (spot plus 1) of floors. If upper is at most lower, set boundary to spot plus 1, then stop.\n\nReport boundary.\n","expected":"3\n","step_budget":2000000},{"id":916,"slug":"word-subsets","title":"Word Subsets","difficulty":"Medium","category":"Array","code":"Keep a shared current as empty text. Keep a shared alphabet as empty text. Keep a shared required as an empty list of whole numbers. Keep a shared seen of 0. Keep a shared enough of 0.\nFor every spot from 0 to 25.\nPlace 0 into required.\n\nTo require. Set seen to 0.\nFor every spot from 0 to 25.\nSet seen to 0. The symbol is character spot of alphabet. For every place from 0 to the last position of current, if character place of current is symbol, add 1 to seen. If seen is more than item spot of required, set item spot of required to seen.\n\nTo check. Set enough to 1.\nFor every spot from 0 to 25.\nSet seen to 0. The symbol is character spot of alphabet. For every place from 0 to the last position of current, if character place of current is symbol, add 1 to seen. If seen is less than item spot of required, set enough to 0.\n\nThe words is a list of \"amazon\", \"apple\", \"facebook\", \"google\", and \"leetcode\". The demands is a list of \"e\" and \"o\". Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet.\nFor each demand in demands.\nSet current to demand. Require.\n\nFor each word in words.\nSet current to word. Check. If enough is 1, report word.\n","expected":"facebook\ngoogle\nleetcode\n","step_budget":2000000},{"id":917,"slug":"reverse-only-letters","title":"Reverse Only Letters","difficulty":"Easy","category":"String","code":"Keep a shared code of 0. Keep a shared verdict of 0. Keep a shared lower as empty text. Keep a shared upper as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into lower. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into upper.\n\nTo classify. Set verdict to 0. For every spot from 0 to 25, if code is character spot of lower, set verdict to 1. For every spot from 0 to 25, if code is character spot of upper, set verdict to 1.\n\nThe source is \"ab-cd\". The pieces is an empty list of text.\nFor every spot from 0 to the last position of source.\nThe piece is the slice of source from spot to spot plus 1. Place piece into pieces.\n\nThe left is 0. The right is the last position of pieces.\nRepeat while left is less than right.\nThe here is item left of pieces. The there is item right of pieces. Set code to character 0 of here. Classify. The leftok is verdict. Set code to character 0 of there. Classify. The rightok is verdict. If leftok is 1 and rightok is 1, swap item left of pieces and item right of pieces, add 1 to left, subtract 1 from right. If leftok is 0, add 1 to left. If rightok is 0, subtract 1 from right.\n\nThe answer is join pieces with \"\". Show answer.\n","expected":"dc-ba\n","step_budget":2000000},{"id":918,"slug":"maximum-sum-circular-subarray","title":"Maximum Sum Circular Subarray","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, -2, 3, and -2. The best is item 0 of numbers. The worst is item 0 of numbers. The ceiling is 0, while the floor is 0. The total is 0.\nFor every spot from 0 to the last position of numbers.\nThe value is item spot of numbers. Set ceiling to the larger of ceiling plus value and value. Set floor to the smaller of floor plus value and value. Set best to the larger of best and ceiling. Set worst to the smaller of worst and floor. Add value to total.\n\nIf best is less than 0, show best.\nIf best is at least 0.\nThe wrapped is total minus worst. The answer is the larger of best and wrapped. Show answer.\n","expected":"3\n","step_budget":2000000},{"id":920,"slug":"number-of-music-playlists","title":"Number of Music Playlists","difficulty":"Hard","category":"Math","code":"The songs is 3, while the goal is 3. The gap is 1. The modulo is 1000000007. The width is songs plus 1. The size is (goal plus 1) times width. The ways is a list of size zeros. Set item 0 of ways to 1.\nFor every length from 1 to goal.\nFor every unique from 1 to songs.\nIf length is at least unique.\nThe at is length times width plus unique. The before is (length minus 1) times width plus (unique minus 1). The fresh is item before of ways times (songs minus unique plus 1). The prior is (length minus 1) times width plus unique. The old is item prior of ways. The factor is the larger of unique minus gap and 0. The reuse is old times factor. The total is fresh plus reuse. The reduced is total modulo modulo. Set item at of ways to reduced.\n\nThe target is goal times width plus songs. Report item target of ways.\n","expected":"6\n","step_budget":2000000},{"id":921,"slug":"minimum-add-to-make-parentheses-valid","title":"Minimum Add to Make Parentheses Valid","difficulty":"Medium","category":"String","code":"The source is \"())\". The opened is 0. The added is 0.\nFor every spot from 0 to the last position of source.\nThe symbol is the slice of source from spot to spot plus 1. If symbol is \"(\", add 1 to opened. If symbol is \")\", subtract 1 from opened. If opened is less than 0, add 1 to added, set opened to 0.\n\nReport added.\n","expected":"1\n","step_budget":2000000},{"id":922,"slug":"sort-array-by-parity-ii","title":"Sort Array By Parity II","difficulty":"Easy","category":"Array","code":"The numbers is a list of 4, 2, 5, and 7. The size is the number of items in numbers. The answer is a list of size zeros. The even is 0. The odd is 1.\nFor each value in numbers.\nIf value modulo 2 is 0, set item even of answer to value, add 2 to even. If value modulo 2 is 1, set item odd of answer to value, add 2 to odd.\n\nFor each value in answer, show value.\n","expected":"4\n5\n2\n7\n","step_budget":2000000},{"id":923,"slug":"3sum-with-multiplicity","title":"3Sum With Multiplicity","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 1, 2, 2, 2, and 2. The target is 5. The last is the last position of numbers. The count is 0.\nFor every first from 0 to last.\nFor every second from first plus 1 to last.\nFor every third from second plus 1 to last.\nThe total is item first of numbers plus item second of numbers plus item third of numbers. If total is target, add 1 to count.\n\nReport count.\n","expected":"12\n","step_budget":2000000},{"id":924,"slug":"minimize-malware-spread","title":"Minimize Malware Spread","difficulty":"Hard","category":"Array","code":"Keep a shared edges holding 1 and 0. Keep a shared starts holding 0, 1, and 2. Keep a shared counts holding 1, 1, and 0. Keep a shared initial holding 0 and 1. Keep a shared infected holding 0, 0, and 0. Keep a shared banned of 0. Keep a shared total of 0.\n\nTo spread. For every node from 0 to 2, set item node of infected to 0. Set total to 0. The queue is an empty list of whole numbers. For each seed in initial, if seed is not banned and item seed of infected is 0, set item seed of infected to 1, add 1 to total, Place seed into queue. The head is 0.\nRepeat while head is at most the last position of queue.\nThe node is item head of queue. Add 1 to head.\nFor every offset from 0 to item node of counts minus 1.\nThe next is item (item node of starts plus offset) of edges. If item next of infected is 0, set item next of infected to 1, add 1 to total, Place next into queue.\n\nThe best is 4. The answer is -1.\nFor each candidate in initial.\nSet banned to candidate. Spread. If total is less than best, set best to total, set answer to candidate. If total is best and candidate is less than answer, set answer to candidate.\n\nReport answer.\n","expected":"0\n","step_budget":2000000},{"id":925,"slug":"long-pressed-name","title":"Long Pressed Name","difficulty":"Easy","category":"String","code":"The name is \"alex\", while the typed is \"aaleex\". The namechars is an empty list of text. The namecounts is an empty list of whole numbers.\nFor every spot from 0 to the last position of name.\nThe symbol is the slice of name from spot to spot plus 1. If spot is 0, Place symbol into namechars, Place 1 into namecounts.\nIf spot is more than 0.\nThe prior is the slice of name from spot minus 1 to spot. If symbol matches prior, The local is the last position of namecounts, set item local of namecounts to item local of namecounts plus 1. If symbol does not match prior, Place symbol into namechars, Place 1 into namecounts.\n\nThe typedchars is an empty list of text. The typedcounts is an empty list of whole numbers.\nFor every spot from 0 to the last position of typed.\nThe symbol is the slice of typed from spot to spot plus 1. If spot is 0, Place symbol into typedchars, Place 1 into typedcounts.\nIf spot is more than 0.\nThe prior is the slice of typed from spot minus 1 to spot. If symbol matches prior, The local is the last position of typedcounts, set item local of typedcounts to item local of typedcounts plus 1. If symbol does not match prior, Place symbol into typedchars, Place 1 into typedcounts.\n\nThe good is 1. The namegroups is the number of items in namechars. The typedgroups is the number of items in typedchars. If namegroups is not typedgroups, set good to 0.\nFor every spot from 0 to the last position of namechars.\nIf item spot of namechars does not match item spot of typedchars, set good to 0. If item spot of typedcounts is less than item spot of namecounts, set good to 0.\n\nIf good is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":926,"slug":"flip-string-to-monotone-increasing","title":"Flip String to Monotone Increasing","difficulty":"Medium","category":"String","code":"The source is \"00110\". The ones is 0. The flips is 0.\nFor every spot from 0 to the last position of source.\nThe symbol is the slice of source from spot to spot plus 1. If symbol is \"1\", add 1 to ones. If symbol is \"0\", add 1 to flips. If flips is more than ones, set flips to ones.\n\nReport flips.\n","expected":"1\n","step_budget":2000000},{"id":927,"slug":"three-equal-parts","title":"Three Equal Parts","difficulty":"Hard","category":"Array","code":"The bits is a list of 1, 0, 1, 0, and 1. The last is the last position of bits. The size is last plus 1. The ones is an empty list of whole numbers.\nFor every spot from 0 to last.\nIf item spot of bits is 1, Place spot into ones.\n\nThe count is the number of items in ones. The valid is 1.\nIf count is 0.\nShow 0. Show last. Set valid to 0.\n\nIf count is more than 0 and count modulo 3 is not 0.\nShow -1. Show -1. Set valid to 0.\n\nThe good is 1. The left is -1. The right is -1.\nIf valid is 1.\nThe group is count divided by 3. The firststart is item 0 of ones. The secondstart is item group of ones. The thirdstart is item (group plus group) of ones. The span is size minus thirdstart. Set left to firststart plus span minus 1. Set right to secondstart plus span.\nFor every offset from 0 to span minus 1.\nThe first is item (firststart plus offset) of bits. The second is item (secondstart plus offset) of bits. The third is item (thirdstart plus offset) of bits. If first is not second, set good to 0. If first is not third, set good to 0.\n\nIf valid is 1 and good is 0, show -1, show -1. If valid is 1 and good is 1, Show left, Show right.\n","expected":"0\n3\n","step_budget":2000000},{"id":928,"slug":"minimize-malware-spread-ii","title":"Minimize Malware Spread II","difficulty":"Hard","category":"Array","code":"Keep a shared graph holding 1, 1, 0, 1, 1, 0, 0, 0, and 1. Keep a shared initial holding 0 and 1. Keep a shared infected holding 0, 0, and 0. Keep a shared candidate of 0. Keep a shared cases of 0.\n\nTo erase from spot (a whole number).\nFor every node from 0 to 2.\nSet item node of infected to 0.\n\nTo spread from node (a whole number). If node is candidate, return. If item node of infected is 1, return. Set item node of infected to 1. The base is node times 3.\nFor every neighbor from 0 to 2.\nIf item (base plus neighbor) of graph is 1, Spread from neighbor.\n\nTo infect from spot (a whole number).\nFor each other in initial.\nIf other is not candidate, Spread from other.\n\nTo tally from spot (a whole number).\nFor every node from 0 to 2.\nIncrease cases by item node of infected.\n\nThe best is 4, while the bestnode is 0.\nFor every position from 0 to the last position of initial.\nThe cand is item position of initial. Set candidate to cand. Set cases to 0. Erase from 0. Infect from 0. Tally from 0. If cases is less than best, set best to cases, set bestnode to cand.\n\nShow bestnode.\n","expected":"0\n","step_budget":2000000},{"id":929,"slug":"unique-email-addresses","title":"Unique Email Addresses","difficulty":"Easy","category":"Array","code":"Keep a shared emails holding \"test.email+alex@leetcode.com\", \"test.e.mail+bob.cathy@leetcode.com\", and \"testemail+david@lee.tcode.com\". Keep a shared ordered as an empty list of text. Keep a shared built as empty text.\n\nTo normalize from position (a whole number). The email is item position of emails. The size is the number of characters in email. Set built to empty text. The at is 0, while the skipping is 0, while the keep is 0, while the dot is 0, while the plus is 0, while the sign is 0.\nFor every spot from 0 to size minus 1.\nSet keep to 0. Set dot to 0. Set plus to 0. Set sign to 0. The here is the slice of email from spot to spot plus 1. If here matches \".\", set dot to 1. If here matches \"+\", set plus to 1. If here matches \"@\", set sign to 1. If at is 0 and skipping is 0, set keep to 1. If at is 1, set keep to 1. If at is 0 and dot is 1, set keep to 0. If sign is 1, set keep to 0. If at is 0 and plus is 1, set keep to 0. If plus is 1, set skipping to 1. If keep is 1, Place here into built. If sign is 1 and at is 0, Place \"@\" into built. If sign is 1, set at to 1.\n\nFor every position from 0 to the last position of emails.\nNormalize from position. Place built into ordered.\n\nThe last is the last position of ordered.\nFor every left from 0 to last.\nFor every right from left to last.\nThe rightword is item right of ordered. The leftword is item left of ordered. If rightword comes before leftword, swap item left of ordered and item right of ordered.\n\nThe count is 1.\nFor every position from 1 to last.\nThe here is item position of ordered. The prior is item (position minus 1) of ordered. If here does not match prior, add 1 to count.\n\nShow count.\n","expected":"2\n","step_budget":4777302},{"id":930,"slug":"binary-subarrays-with-sum","title":"Binary Subarrays With Sum","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 0, 1, 0, and 1. The goal is 2. The last is the last position of numbers. The total is 0.\nFor every start from 0 to last.\nThe window is 0.\nFor every finish from start to last.\nIncrease window by item finish of numbers. If window is goal, add 1 to total.\n\nShow total.\n","expected":"4\n","step_budget":2000000},{"id":931,"slug":"minimum-falling-path-sum","title":"Minimum Falling Path Sum","difficulty":"Medium","category":"Array","code":"The cells is a list of 2, 1, 3, 6, 5, 4, 7, 8, and 9. The width is 3, while the height is 3. The table is a list of 9 zeros.\nFor every column from 0 to 2.\nSet item column of table to item column of cells.\n\nFor every level from 1 to height minus 1.\nFor every column from 0 to width minus 1.\nThe index is (level times width) plus column. The above is index minus width. The best is item above of table. If column is more than 0, set best to the smaller of best and item (above minus 1) of table. If column is less than width minus 1, set best to the smaller of best and item (above plus 1) of table. Set item index of table to best plus item index of cells.\n\nThe last is the last position of table. The answer is item (last minus 2) of table.\nFor every column from 1 to 2.\nThe candidate is item (last minus 2 plus column) of table. If candidate is less than answer, set answer to candidate.\n\nShow answer.\n","expected":"13\n","step_budget":2000000},{"id":932,"slug":"beautiful-array","title":"Beautiful Array","difficulty":"Medium","category":"Array","code":"The target is 5. The working is a list of 1. The size is 1, while the nextsize is 0. Keep a shared next as an empty list of whole numbers.\nTo prune from position (a whole number).\nRepeat while the number of items in next is more than 0.\nRemove the last item from next.\n\nRepeat while size is less than target.\nPrune from 0. Set nextsize to 0.\nFor every step from 0 to (size times 2) minus 1.\nThe source is step modulo size. The value is item source of working. The doubled is value times 2. The candidate is doubled. If step is less than size, set candidate to doubled minus 1. If candidate is at most target, Place candidate into next, add 1 to nextsize. If step is (size times 2) minus 1, set working to next, set size to nextsize.\n\nFor each value in working, show value.\n","expected":"1\n5\n3\n2\n4\n","step_budget":2000000},{"id":934,"slug":"shortest-bridge","title":"Shortest Bridge","difficulty":"Medium","category":"Array","code":"Keep a shared land holding 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, and 0. Keep a shared seen as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers.\nFor every spot from 0 to 15.\nPlace 0 into seen.\n\nTo mark from node (a whole number). If node is less than 0, return. If node is more than 15, return. If item node of land is 0, return. If item node of seen is 1, return. Set item node of seen to 1. Place node into queue. Mark from node minus 4. Mark from node plus 4. Mark from node minus 1. Mark from node plus 1.\n\nMark from 6. The distance is an empty list of whole numbers.\nFor every spot from 0 to 15.\nPlace 100 into distance.\n\nFor every spot from 0 to 15.\nIf item spot of seen is 1, set item spot of distance to 0.\n\nRepeat 20 times.\nFor every node from 0 to 15.\nThe here is item node of distance. If node is at least 4 and here is less than 100 and item (node minus 4) of distance is more than here plus 1, set item (node minus 4) of distance to here plus 1. If node is at most 11 and here is less than 100 and item (node plus 4) of distance is more than here plus 1, set item (node plus 4) of distance to here plus 1. If node modulo 4 is more than 0 and here is less than 100 and item (node minus 1) of distance is more than here plus 1, set item (node minus 1) of distance to here plus 1. If node modulo 4 is less than 3 and here is less than 100 and item (node plus 1) of distance is more than here plus 1, set item (node plus 1) of distance to here plus 1.\n\nThe answer is 100.\nFor every node from 0 to 15.\nIf item node of land is 1 and item node of seen is 0 and item node of distance is less than answer, set answer to item node of distance.\n\nShow answer minus 1.\n","expected":"1\n","step_budget":2000000},{"id":935,"slug":"knight-dialer","title":"Knight Dialer","difficulty":"Medium","category":"Dynamic Programming","code":"The steps is 2. The origins is an empty list of whole numbers. The targets is an empty list of whole numbers. Place 0 into origins. Place 4 into targets. Place 0 into origins. Place 6 into targets. Place 1 into origins. Place 6 into targets. Place 1 into origins. Place 8 into targets. Place 2 into origins. Place 7 into targets. Place 2 into origins. Place 9 into targets. Place 3 into origins. Place 4 into targets. Place 3 into origins. Place 8 into targets. Place 4 into origins. Place 0 into targets. Place 4 into origins. Place 3 into targets. Place 4 into origins. Place 9 into targets. Place 6 into origins. Place 0 into targets. Place 6 into origins. Place 1 into targets. Place 6 into origins. Place 7 into targets. Place 7 into origins. Place 2 into targets. Place 7 into origins. Place 6 into targets. Place 8 into origins. Place 1 into targets. Place 8 into origins. Place 3 into targets. Place 9 into origins. Place 2 into targets. Place 9 into origins. Place 4 into targets. The current is an empty list of whole numbers.\nFor every digit from 0 to 9.\nPlace 1 into current.\n\nThe next is an empty list of whole numbers.\nFor every digit from 0 to 9.\nPlace 0 into next.\n\nRepeat while steps is more than 1.\nFor every step from 0 to 29.\nIf step is less than 10, set item step of next to 0. If step is at least 10, The edge is step minus 10, The source is item edge of origins, The target is item edge of targets, The contribution is item source of current, set item target of next to (item target of next plus contribution) modulo 1000000007. If step is 29, set current to next. Subtract 1 from steps.\n\nThe total is 0.\nFor every digit from 0 to 9.\nIncrease total by item digit of current.\n\nShow total.\n","expected":"20\n","step_budget":2000000},{"id":936,"slug":"stamping-the-sequence","title":"Stamping The Sequence","difficulty":"Hard","category":"String","code":"The stamp is \"abc\", while the target is \"ababc\". The state is an empty list of text. The marks is an empty list of text. The blanks is an empty list of text. Place \"?\" into blanks. The lasttarget is the last position of target. The laststamp is the last position of stamp.\nFor every spot from 0 to lasttarget.\nThe piece is the slice of target from spot to spot plus 1. Place piece into state.\nFor every spot from 0 to laststamp.\nThe piece is the slice of stamp from spot to spot plus 1. Place piece into marks.\n\nThe found is an empty list of whole numbers. The match is 1, while the unknown is 0, while the blank is 0, while the same is 0.\nFor every round from 0 to lasttarget.\nFor every start from 0 to lasttarget minus laststamp.\nSet match to 1. Set unknown to 0.\nFor every offset from 0 to laststamp.\nThe spot is start plus offset. The here is item spot of state. The wanted is item offset of marks. Set blank to 0. Set same to 0. If here matches \"?\", set blank to 1. If here matches wanted, set same to 1. If blank is 0 and same is 0, set match to 0. If blank is 0, add 1 to unknown. If offset is laststamp and match is 1 and unknown is more than 0, set item start of state to item 0 of blanks, set item (start plus 1) of state to item 0 of blanks, set item (start plus 2) of state to item 0 of blanks, Place start into found.\n\nThe last is the last position of found.\nFor every spot from 0 to last.\nThe back is last minus spot. Show item back of found.\n","expected":"0\n2\n","step_budget":2000000},{"id":937,"slug":"reorder-data-in-log-files","title":"Reorder Data in Log Files","difficulty":"Medium","category":"Array","code":"Keep a shared logs holding \"dig1 8 1 5 1\", \"let1 art can\", \"let2 own kit dig\", and \"let3 art zero\". Keep a shared content as empty text. Keep a shared letterflag of 0. Keep a shared digitwords holding \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", and \"9\".\n\nTo extract from position (a whole number). The log is item position of logs. The parts is split log by \" \". The last is the last position of parts. Set content to empty text.\nFor every index from 1 to last.\nPlace item index of parts into content. If index is less than last, Place \" \" into content.\n\nTo classify from position (a whole number). The log is item position of logs. The parts is split log by \" \". The word is item 1 of parts. The lead is the slice of word from 0 to 1.\nFor every digit from 0 to 9.\nThe digittext is item digit of digitwords. If lead matches digittext, set letterflag to 0.\n\nThe ids is an empty list of text. The contents is an empty list of text. The kinds is an empty list of whole numbers.\nFor every position from 0 to the last position of logs.\nThe log is item position of logs. The parts is split log by \" \". Place item 0 of parts into ids. Extract from position. Place content into contents. Set letterflag to 1. Classify from position. Place letterflag into kinds.\n\nThe last is the last position of logs.\nFor every left from 0 to last.\nFor every right from left to last.\nThe should is 0. The leftcontent is item left of contents. The rightcontent is item right of contents. The leftid is item left of ids. The rightid is item right of ids. The ahead is 0. If rightcontent comes before leftcontent, set ahead to 1. If rightcontent matches leftcontent, set ahead to 0. If rightcontent matches leftcontent, If rightid comes before leftid, set ahead to 1. If item left of kinds is 0 and item right of kinds is 1, set should to 1. If item left of kinds is 1 and item right of kinds is 1 and ahead is 1, set should to 1. If should is 1, swap item left of ids and item right of ids, swap item left of contents and item right of contents, swap item left of kinds and item right of kinds.\n\nFor every position from 0 to last.\nThe line is empty text. Place item position of ids into line. Place \" \" into line. Place item position of contents into line. Show line.\n","expected":"let1 art can\nlet3 art zero\nlet2 own kit dig\ndig1 8 1 5 1\n","step_budget":2000000},{"id":938,"slug":"range-sum-of-bst","title":"Range Sum of BST","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 10, 5, 15, 3, 7, -1, and 18. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1. Keep a shared low of 0. Keep a shared high of 0. Keep a shared total of 0. Set low to 7. Set high to 15.\n\nTo gather from node (a whole number). If node is less than 0, return. The value is item node of values. If value is at least low and value is at most high, add value to total. If value is more than low, Gather from item node of lefts. If value is less than high, Gather from item node of rights.\n\nGather from 0. Show total.\n","expected":"32\n","step_budget":2000000},{"id":939,"slug":"minimum-area-rectangle","title":"Minimum Area Rectangle","difficulty":"Medium","category":"Array","code":"The xs is a list of 1, 1, 3, and 3. The ys is a list of 1, 3, 1, and 3. The last is the last position of xs. The best is 1000000.\nFor every first from 0 to last.\nFor every second from first plus 1 to last.\nThe xone is item first of xs, while the yone is item first of ys. The xtwo is item second of xs, while the ytwo is item second of ys.\nIf xone is not xtwo and yone is not ytwo.\nThe haveone is 0, while the havetwo is 0.\nFor every third from 0 to last.\nThe xhere is item third of xs, while the yhere is item third of ys. If xhere is xone and yhere is ytwo, set haveone to 1. If xhere is xtwo and yhere is yone, set havetwo to 1. If third is last and haveone is 1 and havetwo is 1, The wide is the absolute value of (xone minus xtwo), The tall is the absolute value of (yone minus ytwo), The area is wide times tall, If area is less than best, set best to area.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":940,"slug":"distinct-subsequences-ii","title":"Distinct Subsequences II","difficulty":"Hard","category":"String","code":"The word is \"abc\". The size is the number of characters in word. The ways is an empty list of whole numbers.\nFor every spot from 0 to size.\nPlace 0 into ways.\n\nSet item 0 of ways to 1.\nFor every finish from 1 to size.\nSet item finish of ways to (item (finish minus 1) of ways times 2) modulo 1000000007. The piece is the slice of word from (finish minus 1) to finish. The previous is 0 minus 1.\nFor every back from 0 to finish minus 2.\nThe otherpiece is the slice of word from back to back plus 1. If otherpiece matches piece, set previous to back. If back is finish minus 2 and previous is at least 0, set item finish of ways to (item finish of ways minus item previous of ways) modulo 1000000007.\n\nShow item size of ways minus 1.\n","expected":"7\n","step_budget":2000000},{"id":941,"slug":"valid-mountain-array","title":"Valid Mountain Array","difficulty":"Easy","category":"Array","code":"The heights is a list of 0, 3, 2, and 1. The last is the last position of heights. The crest is 0.\nRepeat while crest is less than last and item crest of heights is less than item (crest plus 1) of heights.\nAdd 1 to crest.\n\nThe base is crest.\nRepeat while base is less than last and item base of heights is more than item (base plus 1) of heights.\nAdd 1 to base.\n\nIf crest is more than 0 and crest is less than last and base is last, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":942,"slug":"di-string-match","title":"DI String Match","difficulty":"Easy","category":"Array","code":"The pattern is \"IDID\". The size is the number of characters in pattern. The low is 0. The high is size. The answers is an empty list of whole numbers.\nFor every spot from 0 to size minus 1.\nIf character spot of pattern is \"I\", place low into answers, add 1 to low. If character spot of pattern is \"D\", place high into answers, set high to high minus 1.\n\nPlace low into answers. For each answer in answers, show answer.\n","expected":"0\n4\n1\n3\n2\n","step_budget":2000000},{"id":943,"slug":"find-the-shortest-superstring","title":"Find the Shortest Superstring","difficulty":"Hard","category":"Array","code":"Keep a shared words as an empty list of text. Keep a shared order as an empty list of whole numbers. Keep a shared used as an empty list of whole numbers. Place \"catg\" into words. Place \"ctaagt\" into words. Place \"gcta\" into words. Place 0 into used. Place 0 into used. Place 0 into used. Keep a shared current as empty text. Keep a shared answer as empty text. Keep a shared shortest of 0. Keep a shared word as empty text. Keep a shared overlap of 0. Keep a shared agree of 0.\n\nTo check from span (a whole number). Set agree to 1. The last is the last position of current. The width is last plus 1. The begin is width minus span.\nFor every offset from 0 to span minus 1.\nThe actual is character (begin plus offset) of current. The wanted is character offset of word. If actual is not wanted, set agree to 0, stop.\n\nTo match. The last is the last position of current. The width is last plus 1. The final is the last position of word. The reach is final plus 1. The limit is the smaller of width and reach. Set overlap to 0.\nFor every span from 1 to limit.\nCheck from span. If agree is 1, set overlap to span.\n\nTo join from place (a whole number). The chosen is item place of order. The next is item chosen of words. Set word to next. Match. The last is the last position of word. The reach is last plus 1. The tail is the slice of word from overlap to reach. Place tail into current.\n\nTo assess. The first is item 0 of order. The seed is item first of words. Set current to seed. For every place from 1 to 2, Join from place. The close is the last position of current. The width is close plus 1. The copy is a copy of current. If shortest is 0 or width is less than shortest, set shortest to width, set answer to copy.\n\nTo take from spot (a whole number) with depth (a whole number). Place spot into order. Set item spot of used to 1. Arrange from depth plus 1. Remove the last item from order. Set item spot of used to 0.\n\nTo arrange from depth (a whole number). If depth is 3, Assess, return. For every spot from 0 to 2, if item spot of used is 0, Take from spot with depth.\n\nArrange from 0. Show answer.\n","expected":"catgctaagt\n","step_budget":2000000},{"id":944,"slug":"delete-columns-to-make-sorted","title":"Delete Columns to Make Sorted","difficulty":"Easy","category":"Array","code":"Keep a shared board holding \"cba\", \"daf\", and \"ghi\". Keep a shared removed of 0. The opening is item 0 of board. The last column is the last position of opening.\n\nTo inspect with column (a whole number). The top is item 0 of board. The earlier is the slice of top from column to column plus 1.\nFor every row from 1 to the last position of board.\nThe line is item row of board. The letter is the slice of line from column to column plus 1. If letter comes before earlier, set removed to removed plus 1, stop. Set earlier to letter.\n\nFor every column from 0 to last column.\nInspect with column.\n\nShow removed.\n","expected":"1\n","step_budget":2000000},{"id":945,"slug":"minimum-increment-to-make-array-unique","title":"Minimum Increment to Make Array Unique","difficulty":"Medium","category":"Array","code":"The numbers is a list of 3, 2, 1, 2, 1, and 7. The last is the last position of numbers. Sort numbers. The raised is 0.\nFor every spot from 1 to last.\nIf item spot of numbers is at most item (spot minus 1) of numbers.\nThe gap is item (spot minus 1) of numbers minus item spot of numbers plus 1. Add gap to raised. Set item spot of numbers to item (spot minus 1) of numbers plus 1.\n\nShow raised.\n","expected":"6\n","step_budget":2000000},{"id":946,"slug":"validate-stack-sequences","title":"Validate Stack Sequences","difficulty":"Medium","category":"Array","code":"Keep a shared popped holding 4, 5, 3, 2, and 1. Keep a shared stack as an empty list of whole numbers. Keep a shared next of 0. The pushed is a list of 1, 2, 3, 4, and 5.\n\nTo drain. The final is the last position of popped.\nRepeat while the number of items in stack is more than 0 and next is at most final.\nThe local is next. The size is the number of items in stack. The top is item (size minus 1) of stack. If top is not item local of popped, stop. remove the last item from stack. Add 1 to next.\n\nFor each value in pushed.\nPlace value into stack. Drain.\n\nThe final is the last position of popped. If next is more than final, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":947,"slug":"most-stones-removed-with-same-row-or-column","title":"Most Stones Removed with Same Row or Column","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared columns holding 0, 0, 1, 1, 2, and 2. Keep a shared rows holding 0, 1, 0, 2, 1, and 2. Keep a shared parents as an empty list of whole numbers. Keep a shared chief of 0.\n\nTo locate from stone (a whole number). If item stone of parents is stone, set chief to stone, return. The up is item stone of parents. Locate from up. Set item stone of parents to item up of parents.\n\nTo attach from first (a whole number) with second (a whole number). Locate from first. The one is chief. Locate from second. The two is chief. If one is not two, set item one of parents to two.\n\nTo pair from first (a whole number).\nFor every second from first plus 1 to the last position of parents.\nIf item first of columns is item second of columns or item first of rows is item second of rows, attach from first with second.\n\nFor every stone from 0 to the last position of columns.\nPlace stone into parents.\n\nFor every first from 0 to the last position of parents.\nPair from first.\n\nThe roots is 0.\nFor every stone from 0 to the last position of parents.\nIf item stone of parents is stone, add 1 to roots.\n\nThe final stone is the last position of columns. The total is final stone plus 1. The answer is total minus roots. Show answer.\n","expected":"5\n","step_budget":2000000},{"id":948,"slug":"bag-of-tokens","title":"Bag of Tokens","difficulty":"Medium","category":"Array","code":"The tokens is a list of 100, 200, 300, and 400. The power is 200. Sort tokens. The low is 0. The high is the last position of tokens. The coins is 0. The best is 0.\nRepeat while low is at most high.\nIf power is at least item low of tokens, set power to power minus item low of tokens, add 1 to coins, add 1 to low, set best to coins. If low is at most high and power is less than item low of tokens and coins is more than 0, set power to power plus item high of tokens, set high to high minus 1, set coins to coins minus 1. If low is at most high and power is less than item low of tokens and coins is 0, stop.\n\nShow best.\n","expected":"2\n","step_budget":2000000},{"id":949,"slug":"largest-time-for-given-digits","title":"Largest Time for Given Digits","difficulty":"Medium","category":"Array","code":"Keep a shared digits holding 1, 2, 3, and 4. Keep a shared order as an empty list of whole numbers. Keep a shared used holding 0, 0, 0, and 0. Keep a shared latest of 0. Keep a shared pieces as an empty list of text.\n\nTo pad with value (a whole number).\nIf value is less than 10.\nPlace \"0\" into pieces.\n\nTo assess. The first is item 0 of order. The second is item 1 of order. The third is item 2 of order. The fourth is item 3 of order. The one is item first of digits. The two is item second of digits. The three is item third of digits. The four is item fourth of digits. The hours is one times 10 plus two. The minutes is three times 10 plus four.\nIf hours is less than 24 and minutes is less than 60.\nThe total is hours times 60 plus minutes. If total is more than latest, set latest to total.\n\nTo take from spot (a whole number) with depth (a whole number). Place spot into order. Set item spot of used to 1. Arrange from depth plus 1. remove the last item from order. Set item spot of used to 0.\n\nTo arrange from depth (a whole number). If depth is 4, Assess, return. For every spot from 0 to 3, if item spot of used is 0, Take from spot with depth.\n\nArrange from 0. The hours is latest divided by 60. The minutes is latest modulo 60. Pad with hours. The hour piece is format whole number hours as text. Place hour piece into pieces. Place \":\" into pieces. Pad with minutes. The minute piece is format whole number minutes as text. Place minute piece into pieces. The answer is join pieces with \"\". Show answer.\n","expected":"23:41\n","step_budget":2000000},{"id":950,"slug":"reveal-cards-in-increasing-order","title":"Reveal Cards In Increasing Order","difficulty":"Medium","category":"Array","code":"The deck is a list of 17, 13, 11, 2, 3, 5, and 7. The last is the last position of deck. Sort deck. Keep a shared places as an empty list of whole numbers. Keep a shared head of 0. For every spot from 0 to last, place spot into places. The result is a list of 7 zeros.\n\nTo cycle. The local is head. Place item local of places into places. Add 1 to head.\n\nFor each card in deck.\nThe local is head. The spot is item local of places. Set item spot of result to card. Add 1 to head. The final is the last position of places. If head is at most final, Cycle.\n\nFor each card in result, show card.\n","expected":"2\n13\n3\n11\n5\n17\n7\n","step_budget":2000000},{"id":951,"slug":"flip-equivalent-binary-trees","title":"Flip Equivalent Binary Trees","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared agreement of 0. Keep a shared first values as an empty list of whole numbers. Keep a shared first lefts as an empty list of whole numbers. Keep a shared first rights as an empty list of whole numbers. Keep a shared second values as an empty list of whole numbers. Keep a shared second lefts as an empty list of whole numbers. Keep a shared second rights as an empty list of whole numbers. Place 1 into first values. Place 2 into first values. Place 3 into first values. Place 4 into first values. Place 5 into first values. Place 6 into first values. Place -1 into first values. Place -1 into first values. Place -1 into first values. Place 7 into first values. Place 8 into first values. Place 1 into first lefts. Place 3 into first lefts. Place 5 into first lefts. Place -1 into first lefts. Place 9 into first lefts. Place -1 into first lefts. Place -1 into first lefts. Place -1 into first lefts. Place -1 into first lefts. Place -1 into first lefts. Place -1 into first lefts. Place 2 into first rights. Place 4 into first rights. Place -1 into first rights. Place -1 into first rights. Place 10 into first rights. Place -1 into first rights. Place -1 into first rights. Place -1 into first rights. Place -1 into first rights. Place -1 into first rights. Place -1 into first rights. Place 1 into second values. Place 3 into second values. Place 2 into second values. Place -1 into second values. Place 6 into second values. Place 4 into second values. Place 5 into second values. Place -1 into second values. Place -1 into second values. Place -1 into second values. Place -1 into second values. Place 8 into second values. Place 7 into second values. Place 1 into second lefts. Place -1 into second lefts. Place 5 into second lefts. Place -1 into second lefts. Place -1 into second lefts. Place -1 into second lefts. Place 11 into second lefts. Place -1 into second lefts. Place -1 into second lefts. Place -1 into second lefts. Place -1 into second lefts. Place -1 into second lefts. Place -1 into second lefts. Place 2 into second rights. Place 4 into second rights. Place 6 into second rights. Place -1 into second rights. Place -1 into second rights. Place -1 into second rights. Place 12 into second rights. Place -1 into second rights. Place -1 into second rights. Place -1 into second rights. Place -1 into second rights. Place -1 into second rights. Place -1 into second rights.\n\nSet agreement to 1.\n\nTo compare from first (a whole number) with second (a whole number). If agreement is 0, return. If first is less than 0 and second is less than 0, return. If first is less than 0, set agreement to 0, return. If second is less than 0, set agreement to 0, return. If item first of first values is not item second of second values, set agreement to 0, return. The firstleft is item first of first lefts. The firstright is item first of first rights. The secondleft is item second of second lefts. The secondright is item second of second rights. Set agreement to 1. Compare from firstleft with secondleft. Compare from firstright with secondright. The straight is agreement. Set agreement to 1. Compare from firstleft with secondright. Compare from firstright with secondleft. The crossed is agreement. Set agreement to 0. If straight is 1, set agreement to 1. If crossed is 1, set agreement to 1.\n\nCompare from 0 with 0. If agreement is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":952,"slug":"largest-component-size-by-common-factor","title":"Largest Component Size by Common Factor","difficulty":"Hard","category":"Array","code":"Keep a shared numbers as an empty list of whole numbers. Keep a shared parent as an empty list of whole numbers. Keep a shared divisor of 0. Keep a shared rootanswer of 0. Place 2 into numbers. Place 3 into numbers. Place 6 into numbers. Place 7 into numbers. Place 4 into numbers. Place 12 into numbers. Place 21 into numbers. Place 39 into numbers. Place 0 into parent. Place 1 into parent. Place 2 into parent. Place 3 into parent. Place 4 into parent. Place 5 into parent. Place 6 into parent. Place 7 into parent.\n\nTo measure from first (a whole number) with second (a whole number). If second is 0, set divisor to first, return. Measure from second with first modulo second.\n\nTo root from node (a whole number). Set rootanswer to node. The walker is rootanswer.\nRepeat while item walker of parent is not walker.\nSet rootanswer to item walker of parent. Set walker to rootanswer.\n\nThe last is the last position of numbers.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nMeasure from item left of numbers with item right of numbers.\nIf divisor is more than 1.\nRoot from left. The firstroot is rootanswer. Root from right. The secondroot is rootanswer. If firstroot is not secondroot, set item firstroot of parent to secondroot.\n\nThe roots is an empty list of whole numbers.\nFor every spot from 0 to last.\nRoot from spot. Place rootanswer into roots.\n\nThe largest is 0.\nFor every spot from 0 to last.\nThe base is item spot of roots. The count is 0.\nFor every check from 0 to last.\nIf item check of roots is base, add 1 to count. If count is more than largest, set largest to count.\n\nShow largest.\n","expected":"8\n","step_budget":2000000},{"id":953,"slug":"verifying-an-alien-dictionary","title":"Verifying an Alien Dictionary","difficulty":"Easy","category":"Array","code":"Keep a shared order as empty text. Keep a shared words as an empty list of text. Keep a shared wanted as empty text. Keep a shared rankanswer of 0. Keep a shared sorted of 0. Keep a shared lengths as an empty list of whole numbers. Keep a shared offsets as an empty list of whole numbers. Keep a shared ranks as an empty list of whole numbers. Place \"hlabcdefgijkmnopqrstuvwxyz\" into order. Place \"hello\" into words. Place \"leetcode\" into words. Set sorted to 1.\n\nTo rank from place (a whole number). If place is more than 25, return. The piece is the slice of order from place to place plus 1. If piece matches wanted, set rankanswer to place, return. Rank from place plus 1.\n\nThe at is 0.\nFor each entry in words.\nPlace at into offsets. The end is the last position of entry. The size is end plus 1. Place size into lengths.\nFor every spot from 0 to size minus 1.\nSet wanted to the slice of entry from spot to spot plus 1. Rank from 0. Place rankanswer into ranks. Add 1 to at.\n\nTo verify with pair (a whole number). The firststart is item pair of offsets. The secondstart is item (pair plus 1) of offsets. The limit is item pair of lengths. If item (pair plus 1) of lengths is less than limit, set limit to item (pair plus 1) of lengths. The decided is 0.\nFor every spot from 0 to limit minus 1.\nThe leftrank is item (firststart plus spot) of ranks. The rightrank is item (secondstart plus spot) of ranks. If leftrank is less than rightrank, set decided to 1. If leftrank is more than rightrank, set decided to 2, set sorted to 0. If decided is not 0, stop. If decided is 0 and item pair of lengths is more than item (pair plus 1) of lengths, set sorted to 0.\n\nThe last is the last position of words. The finalpair is last minus 1.\nFor every pair from 0 to finalpair.\nVerify with pair.\n\nIf sorted is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":954,"slug":"array-of-doubled-pairs","title":"Array of Doubled Pairs","difficulty":"Medium","category":"Array","code":"Keep a shared numbers as an empty list of whole numbers. Keep a shared values as an empty list of whole numbers. Keep a shared counts as an empty list of whole numbers. Keep a shared foundat of 0. Keep a shared possible of 0. Keep a shared bestsize of 0. Keep a shared bestspot of 0. Keep a shared bestvalue of 0. Place 4 into numbers. Place -2 into numbers. Place 2 into numbers. Place -4 into numbers.\n\nTo locate from spot (a whole number) with target (a whole number). Set foundat to -1. If spot is more than the last position of values, return. If item spot of values is target, set foundat to spot, return. Locate from spot plus 1 with target.\n\nFor each number in numbers.\nLocate from 0 with number. If foundat is less than 0, Place number into values, Place 1 into counts. The here is foundat. If foundat is at least 0, set item here of counts to item here of counts plus 1.\n\nSet possible to 1. The last is the last position of numbers. The remaining is last plus 1. Locate from 0 with 0.\nIf foundat is at least 0.\nThe zerospot is foundat. If item zerospot of counts modulo 2 is not 0, set possible to 0. Decrease remaining by item zerospot of counts. Set item zerospot of counts to 0.\n\nTo choose. Set bestsize to -1. Set bestspot to -1. Set bestvalue to 0.\nFor every spot from 0 to the last position of values.\nIf item spot of counts is more than 0.\nThe size is the absolute value of item spot of values. If bestsize is less than 0 or size is less than bestsize, set bestsize to size, set bestspot to spot, set bestvalue to item spot of values.\n\nRepeat while remaining is more than 0 and possible is 1.\nChoose. If bestspot is less than 0, set possible to 0, stop. The wanted is bestvalue times 2. Locate from 0 with wanted. If foundat is less than 0, set possible to 0, stop. The chosen is bestspot. The here is foundat. The needed is item chosen of counts. If item here of counts is less than needed, set possible to 0, stop. Decrease item chosen of counts by needed. Decrease item here of counts by needed. Decrease remaining by needed times 2.\n\nIf possible is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":955,"slug":"delete-columns-to-make-sorted-ii","title":"Delete Columns to Make Sorted II","difficulty":"Medium","category":"Array","code":"Keep a shared words as an empty list of text. Keep a shared resolved as an empty list of whole numbers. Keep a shared rows of 0. Keep a shared columns of 0. Keep a shared valid of 0. Keep a shared deleted of 0. Place \"ca\" into words. Place \"bb\" into words. Place \"ac\" into words. Place 0 into resolved. Place 0 into resolved. The last is the last position of words. Set rows to last plus 1. The leftword is item 0 of words. The width is the last position of leftword. Set columns to width plus 1.\n\nTo test with column (a whole number).\nFor every pair from 0 to rows minus 2.\nIf item pair of resolved is 0 and valid is 1.\nThe leftword is item pair of words. The rightword is item (pair plus 1) of words. The left is the slice of leftword from column to column plus 1. The right is the slice of rightword from column to column plus 1. If right comes before left, set valid to 0.\n\nTo settle with column (a whole number).\nFor every pair from 0 to rows minus 2.\nIf item pair of resolved is 0.\nThe leftword is item pair of words. The rightword is item (pair plus 1) of words. The left is the slice of leftword from column to column plus 1. The right is the slice of rightword from column to column plus 1. If left comes before right, set item pair of resolved to 1.\n\nFor every column from 0 to columns minus 1.\nSet valid to 1. Test with column. If valid is 0, add 1 to deleted. If valid is 1, Settle with column.\n\nShow deleted.\n","expected":"1\n","step_budget":2000000},{"id":956,"slug":"tallest-billboard","title":"Tallest Billboard","difficulty":"Hard","category":"Array","code":"Keep a shared rods as an empty list of whole numbers. Keep a shared current as an empty list of whole numbers. Keep a shared following as an empty list of whole numbers. Keep a shared total of 0. Keep a shared size of 0. Keep a shared center of 0. Place 1 into rods. Place 2 into rods. Place 3 into rods. Place 6 into rods.\n\nFor each rod in rods.\nIncrease total by rod.\n\nSet size to total times 2 plus 1. Set center to total.\nFor every slot from 0 to size minus 1.\nPlace -1 into current.\n\nFor every slot from 0 to size minus 1.\nPlace -1 into following.\n\nSet item center of current to 0.\n\nTo extend with rod (a whole number).\nFor every slot from 0 to size minus 1.\nIf item slot of current is at least 0.\nThe height is item slot of current. If height is more than item slot of following, set item slot of following to height. The upper is slot plus rod.\nIf upper is less than size.\nThe raised is height plus rod. If raised is more than item upper of following, set item upper of following to raised. The diff is slot minus center. The raw is diff minus rod. The gap is the absolute value of raw. The lower is gap plus center. The shifted is height. If rod is more than diff, set shifted to height plus rod minus diff. If shifted is more than item lower of following, set item lower of following to shifted.\n\nFor each rod in rods.\nExtend with rod.\nFor every slot from 0 to size minus 1.\nSet item slot of current to item slot of following. Set item slot of following to -1.\n\nThe middle is center. Show item middle of current.\n","expected":"6\n","step_budget":2000000},{"id":957,"slug":"prison-cells-after-n-days","title":"Prison Cells After N Days","difficulty":"Medium","category":"Array","code":"Keep a shared cells holding 0, 1, 0, 1, 1, 0, 0, and 1.\n\nTo advance. The oldcells is a list of item 0 of cells, item 1 of cells, item 2 of cells, item 3 of cells, item 4 of cells, item 5 of cells, item 6 of cells, and item 7 of cells. Set item 0 of cells to 0. Set item 7 of cells to 0.\nFor every place from 1 to 6.\nThe before is item (place minus 1) of oldcells. The after is item (place plus 1) of oldcells. If before is after, set item place of cells to 1. If before is not after, set item place of cells to 0.\n\nThe day is 0. The days is 7.\nRepeat while day is less than days.\nAdvance. Add 1 to day.\n\nThe parts is an empty list of text.\nFor each value in cells.\nThe word is format whole number value as text. Place word into parts.\n\nThe joined is join parts with \",\". The line is empty text. Place \"[\" into line. Place joined into line. Place \"]\" into line. Show line.\n","expected":"[0,0,1,1,0,0,0,0]\n","step_budget":2000000},{"id":958,"slug":"check-completeness-of-a-binary-tree","title":"Check Completeness of a Binary Tree","difficulty":"Medium","category":"Breadth-First Search","code":"Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared emptyseen of 0. Keep a shared complete of 0. Place 1 into values. Place 2 into values. Place 3 into values. Place 4 into values. Place 5 into values. Place 6 into values. Place 1 into lefts. Place 3 into lefts. Place 5 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place 2 into rights. Place 4 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. Set complete to 1.\n\nThe last is the last position of values. The head is 0, while the count is 1. Place 0 into queue.\nRepeat while head is less than count and complete is 1.\nThe node is item head of queue. Add 1 to head. If item node of values is less than 0, set emptyseen to 1.\nIf item node of values is at least 0.\nIf emptyseen is 1, set complete to 0.\nIf emptyseen is 0.\nThe leftindex is node times 2 plus 1. The rightindex is node times 2 plus 2. If leftindex is at most last, Place leftindex into queue, add 1 to count. If rightindex is at most last, Place rightindex into queue, add 1 to count.\n\nIf complete is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":959,"slug":"regions-cut-by-slashes","title":"Regions Cut By Slashes","difficulty":"Medium","category":"Array","code":"Keep a shared grid as an empty list of text. Keep a shared field as an empty list of whole numbers. Keep a shared visited as an empty list of whole numbers. Keep a shared regions of 0. Place \"/\\\\\" into grid. Place \"\\\\/\" into grid.\nFor every spot from 0 to 35.\nPlace 0 into field. Place 0 into visited.\n\nFor every row from 0 to 1.\nThe line is item row of grid.\nFor every column from 0 to 1.\nThe piece is the slice of line from column to column plus 1. The baserow is row times 3. The basecol is column times 3. The top is baserow times 6 plus basecol. If piece matches \"/\", Set item (top plus 2) of field to 1, Set item (top plus 7) of field to 1, Set item (top plus 12) of field to 1. If piece matches \"\\\\\", Set item top of field to 1, Set item (top plus 7) of field to 1, Set item (top plus 14) of field to 1.\n\nTo flood from start (a whole number). The queue is an empty list of whole numbers. Place start into queue. Set item start of visited to 1. The head is 0, while the count is 1.\nRepeat while head is less than count.\nThe cell is item head of queue. Add 1 to head. The row is cell divided by 6. The column is cell modulo 6. If row is more than 0 and item (cell minus 6) of field is 0 and item (cell minus 6) of visited is 0, set item (cell minus 6) of visited to 1, Place (cell minus 6) into queue, add 1 to count. If row is less than 5 and item (cell plus 6) of field is 0 and item (cell plus 6) of visited is 0, set item (cell plus 6) of visited to 1, Place (cell plus 6) into queue, add 1 to count. If column is more than 0 and item (cell minus 1) of field is 0 and item (cell minus 1) of visited is 0, set item (cell minus 1) of visited to 1, Place (cell minus 1) into queue, add 1 to count. If column is less than 5 and item (cell plus 1) of field is 0 and item (cell plus 1) of visited is 0, set item (cell plus 1) of visited to 1, Place (cell plus 1) into queue, add 1 to count.\n\nFor every start from 0 to 35.\nIf item start of field is 0 and item start of visited is 0.\nAdd 1 to regions. Flood from start.\n\nShow regions.\n","expected":"5\n","step_budget":2000000},{"id":960,"slug":"delete-columns-to-make-sorted-iii","title":"Delete Columns to Make Sorted III","difficulty":"Hard","category":"Array","code":"Keep a shared words as an empty list of text. Keep a shared keep as an empty list of whole numbers. Keep a shared rows of 0. Keep a shared cols of 0. Keep a shared fits of 0. Place \"babca\" into words. Place \"bbazb\" into words. Place 1 into keep. Place 1 into keep. Place 1 into keep. Place 1 into keep. Place 1 into keep. The last is the last position of words. Set rows to last plus 1. The sample is item 0 of words. The width is the last position of sample. Set cols to width plus 1.\n\nTo check with left (a whole number) with right (a whole number). Set fits to 1.\nFor every row from 0 to rows minus 1.\nThe word is item row of words. The before is the slice of word from left to left plus 1. The after is the slice of word from right to right plus 1. If after comes before before, set fits to 0.\n\nFor every right from 0 to cols minus 1.\nFor every left from 0 to right minus 1.\nCheck with left with right. If fits is 1 and item left of keep plus 1 is more than item right of keep, set item right of keep to item left of keep plus 1.\n\nThe most is 0.\nFor each value in keep.\nIf value is more than most, set most to value.\n\nShow cols minus most.\n","expected":"3\n","step_budget":2000000},{"id":961,"slug":"n-repeated-element-in-size-2n-array","title":"N-Repeated Element in Size 2N Array","difficulty":"Easy","category":"Array","code":"Keep a shared numbers as an empty list of whole numbers. Keep a shared seen as an empty list of whole numbers. Keep a shared repeated of 0. Place 5 into numbers. Place 1 into numbers. Place 5 into numbers. Place 2 into numbers. Place 5 into numbers. Place 3 into numbers. Place 5 into numbers. Place 4 into numbers.\nFor each value in numbers.\nIf seen contains value, set repeated to value, stop. Place value into seen.\n\nShow repeated.\n","expected":"5\n","step_budget":2000000},{"id":962,"slug":"maximum-width-ramp","title":"Maximum Width Ramp","difficulty":"Medium","category":"Array","code":"Keep a shared numbers as an empty list of whole numbers. Keep a shared best of 0. Place 6 into numbers. Place 0 into numbers. Place 8 into numbers. Place 2 into numbers. Place 1 into numbers. Place 5 into numbers. The last is the last position of numbers.\nFor every left from 0 to last minus 1.\nFor every right from left plus 1 to last.\nIf item right of numbers is at least item left of numbers.\nThe width is right minus left. If width is more than best, set best to width.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":963,"slug":"minimum-area-rectangle-ii","title":"Minimum Area Rectangle II","difficulty":"Medium","category":"Array","code":"Keep a shared xs as an empty list of whole numbers. Keep a shared ys as an empty list of whole numbers. Keep a shared otherone of 0. Keep a shared othertwo of 0. Keep a shared doubled of 0. Place 1 into xs. Place 2 into xs. Place 1 into xs. Place 0 into xs. Place 2 into ys. Place 1 into ys. Place 0 into ys. Place 1 into ys. Set doubled to 1000000.\n\nTo examine with cornerone (a whole number) with cornertwo (a whole number). The thirdspot is otherone. The fourthspot is othertwo. The firstx is item cornerone of xs. The firsty is item cornerone of ys. The secondx is item cornertwo of xs. The secondy is item cornertwo of ys. The thirdx is item thirdspot of xs. The thirdy is item thirdspot of ys. The fourthx is item fourthspot of xs. The fourthy is item fourthspot of ys.\nIf firstx plus thirdx is secondx plus fourthx.\nIf firsty plus thirdy is secondy plus fourthy.\nThe firstdx is thirdx minus firstx. The firstdy is thirdy minus firsty. The seconddx is fourthx minus secondx. The seconddy is fourthy minus secondy. The firstspan is firstdx times firstdx plus firstdy times firstdy. The secondspan is seconddx times seconddx plus seconddy times seconddy.\nIf firstspan is secondspan.\nThe cross is firstdx times seconddy minus firstdy times seconddx. The area is the absolute value of cross. If area is less than doubled, set doubled to area.\n\nThe last is the last position of xs. The finalfirst is last minus 3. The finalsecond is last minus 2. The finalthird is last minus 1.\nFor every cornerone from 0 to finalfirst.\nFor every cornertwo from cornerone plus 1 to finalsecond.\nFor every cornerthree from cornertwo plus 1 to finalthird.\nFor every cornerfour from cornerthree plus 1 to last.\nSet otherone to cornertwo, set othertwo to cornerfour. Examine with cornerone with cornerthree. Set otherone to cornerthree, set othertwo to cornerfour. Examine with cornerone with cornertwo. Set otherone to cornertwo, set othertwo to cornerthree. Examine with cornerone with cornerfour.\n\nThe whole is doubled divided by 2. The line is format whole number whole as text. Place \".\" into line. Place \"0\" into line. Show line.\n","expected":"2.0\n","step_budget":2000000},{"id":964,"slug":"least-operators-to-express-number","title":"Least Operators to Express Number","difficulty":"Hard","category":"Math","code":"Keep a shared costs as an empty list of whole numbers.\nFor every slot from 0 to 200.\nPlace -1 into costs.\n\nKeep a shared base of 0. Keep a shared degree of 0. Keep a shared reachpower of 0. Keep a shared downcost of 0. Set base to 3.\nTo grow with value (a whole number). Set degree to 2. Set reachpower to base times base.\nRepeat while reachpower is less than value.\nSet reachpower to reachpower times base. Add 1 to degree.\n\nTo settle with value (a whole number). The plusway is value times 2 minus 1. The minusway is 2 times (base minus value). Set item value of costs to plusway. If minusway is less than plusway, set item value of costs to minusway.\n\nTo reach with value (a whole number). If item value of costs is at least 0, return. If value is 0, set item 0 of costs to 0, return. If value is 1, set item 1 of costs to 2, return. If base is at least value, Settle with value, return. Grow with value. The savedpower is reachpower. The saveddegree is degree. The spread is savedpower minus value. The lower is savedpower divided by base. Set downcost to 1000000. If spread is less than value, Reach with spread. If spread is less than value, set downcost to saveddegree plus item spread of costs. The firstcost is downcost. Reach with value minus lower. The upcost is saveddegree minus 1 plus item (value minus lower) of costs. Set item value of costs to upcost. If firstcost is less than upcost, set item value of costs to firstcost.\n\nReach with 19. The answer is item 19 of costs minus 1. Show answer.\n","expected":"5\n","step_budget":2000000},{"id":965,"slug":"univalued-binary-tree","title":"Univalued Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 1, 1, 1, 1, 1, and 1. Keep a shared lefts holding 1, 3, 6, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, -1, -1, and -1. Keep a shared answer of 1.\nTo walk from node (a whole number). If node is less than 0, return. If item node of values is not item 0 of values, set answer to 0, return. Walk from item node of lefts. Walk from item node of rights.\n\nWalk from 0. If answer is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":966,"slug":"vowel-spellchecker","title":"Vowel Spellchecker","difficulty":"Medium","category":"Array","code":"Keep a shared words holding \"Kiwi\", \"Kiwi\", \"apple\", \"apple\", and \"banana\". Keep a shared lowers holding \"kiwi\", \"kiwi\", \"apple\", \"apple\", and \"banana\". Keep a shared vowels holding \"k*w*\", \"k*w*\", \"*ppl*\", \"*ppl*\", and \"b*n*n*\". Keep a shared queries holding \"Kiwi\", \"kiwi\", \"Apple\", \"apple\", \"Banana\", and \"banana\". Keep a shared querylowers holding \"kiwi\", \"kiwi\", \"apple\", \"apple\", \"banana\", and \"banana\". Keep a shared queryvowels holding \"k*w*\", \"k*w*\", \"*ppl*\", \"*ppl*\", \"b*n*n*\", and \"b*n*n*\". Keep a shared found of 0. Keep a shared wordlast of 0.\nTo exact from query (a whole number) with word (a whole number). If word is more than wordlast, return. If item query of queries matches item word of words, set found to word, return. Exact from query with word plus 1.\n\nTo lower from query (a whole number) with word (a whole number). If word is more than wordlast, return. If item query of querylowers matches item word of lowers, set found to word, return. Lower from query with word plus 1.\n\nTo vowel from query (a whole number) with word (a whole number). If word is more than wordlast, return. If item query of queryvowels matches item word of vowels, set found to word, return. Vowel from query with word plus 1.\n\nSet wordlast to the last position of words. The querylast is the last position of queries.\nFor every query from 0 to querylast.\nSet found to -1. Exact from query with 0. If found is less than 0, Lower from query with 0. If found is less than 0, Vowel from query with 0. The place is found. If found is at least 0, show item place of words, otherwise show \"none\".\n","expected":"Kiwi\nKiwi\napple\napple\nbanana\nbanana\n","step_budget":2000000},{"id":967,"slug":"numbers-with-same-consecutive-differences","title":"Numbers With Same Consecutive Differences","difficulty":"Medium","category":"Breadth-First Search","code":"Keep a shared answers as an empty list of whole numbers. Keep a shared gap of 7.\nTo extend from value (a whole number) with depth (a whole number). If depth is 0, Place value into answers, return. The lastdigit is value modulo 10. The down is lastdigit minus gap. The up is lastdigit plus gap. If down is at least 0, Extend from value times 10 plus down with depth minus 1. If up is at most 9 and up is not down, Extend from value times 10 plus up with depth minus 1.\n\nFor every first from 1 to 9.\nExtend from first with 2.\n\nSort answers. For each answer in answers, show answer.\n","expected":"181\n292\n707\n818\n929\n","step_budget":2000000},{"id":968,"slug":"binary-tree-cameras","title":"Binary Tree Cameras","difficulty":"Hard","category":"Dynamic Programming","code":"Keep a shared lefts holding 1, 3, -1, -1, and -1. Keep a shared rights holding -1, 4, -1, -1, and -1. Keep a shared marks as an empty list of whole numbers.\nFor every spot from 0 to 4.\nPlace 0 into marks.\n\nThe cameras is 0. The node is 4.\nRepeat while node is at least 0.\nThe left is item node of lefts. The right is item node of rights. The state is 0. If left is at least 0 and item left of marks is 0, set state to 2. If right is at least 0 and item right of marks is 0, set state to 2. If state is 0 and left is at least 0 and item left of marks is 2, set state to 1. If state is 0 and right is at least 0 and item right of marks is 2, set state to 1. If state is 2, add 1 to cameras. Set item node of marks to state. Subtract 1 from node.\n\nIf item 0 of marks is 0, add 1 to cameras. Show cameras.\n","expected":"1\n","step_budget":2000000},{"id":969,"slug":"pancake-sorting","title":"Pancake Sorting","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 3, 2, 4, and 1. Keep a shared flips as an empty list of whole numbers. Keep a shared picked of 0. Keep a shared best of 0.\nTo flip at depth (a whole number). Place depth plus 1 into flips. The low is 0. The high is depth.\nRepeat while low is less than high.\nswap item low of numbers and item high of numbers. Add 1 to low. Subtract 1 from high.\n\nTo locate with limit (a whole number). Set best to item 0 of numbers. Set picked to 0.\nFor every spot from 1 to limit.\nIf item spot of numbers is more than best, set best to item spot of numbers, set picked to spot.\n\nTo arrange with limit (a whole number). Locate with limit. If picked is more than 0, flip at picked. If picked is less than limit and picked is more than 0, flip at limit. If picked is 0, flip at limit.\n\nThe size is the last position of numbers.\nRepeat while size is more than 0.\nArrange with size. Subtract 1 from size.\n\nThe parts is an empty list of text.\nFor each value in flips.\nThe piece is format whole number value as text. Place piece into parts.\n\nThe answer is join parts with \",\". Show answer.\n","expected":"3,4,2,3,2\n","step_budget":2000000},{"id":970,"slug":"powerful-integers","title":"Powerful Integers","difficulty":"Medium","category":"Math","code":"Keep a shared xpowers as an empty list of whole numbers. Keep a shared ypowers as an empty list of whole numbers. Keep a shared totals as an empty list of whole numbers. Keep a shared power of 0. Keep a shared base of 0. Keep a shared bound of 0.\nTo growx. If power is more than bound, return. Place power into xpowers. If base is 1, return. Set power to power times base. Growx.\n\nTo growy. If power is more than bound, return. Place power into ypowers. If base is 1, return. Set power to power times base. Growy.\n\nSet power to 1. Set base to 2. Set bound to 10. Growx. Set power to 1. Set base to 3. Growy.\nFor each left in xpowers.\nFor each right in ypowers.\nThe sum is left plus right. If sum is at most 10, Place sum into totals.\n\nSort totals. The previous is 0.\nFor every spot from 0 to the last position of totals.\nIf spot is 0, show item spot of totals. If spot is more than 0 and item spot of totals is not previous, show item spot of totals. Set previous to item spot of totals.\n","expected":"2\n3\n4\n5\n7\n9\n10\n","step_budget":2000000},{"id":971,"slug":"flip-binary-tree-to-match-preorder-traversal","title":"Flip Binary Tree To Match Preorder Traversal","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, and 3. Keep a shared lefts holding 1, -1, and -1. Keep a shared rights holding 2, -1, and -1. Keep a shared voyage holding 1, 3, and 2. Keep a shared flips as an empty list of whole numbers. Keep a shared pending as an empty list of whole numbers.\nFor every slot from 0 to 99.\nPlace -1 into pending.\n\nSet item 0 of pending to 0. The top is 1. The index is 0. The failed is 0.\nRepeat while top is more than 0 and failed is 0.\nSubtract 1 from top. The node is item top of pending. The start is index. The reach is the last position of voyage. If start is more than reach, set start to 0. If item node of values is not item start of voyage, set failed to 1. If failed is 0, add 1 to index. The position is index. If position is more than reach, set position to 0. The left is item node of lefts. The right is item node of rights. The probeleft is left. If probeleft is less than 0, set probeleft to node. The flip is 0. If left is at least 0 and item probeleft of values is not item position of voyage, set flip to 1. If flip is 1, Place item node of values into flips. If flip is 1 and left is at least 0, Set item top of pending to left, add 1 to top. If flip is 1 and right is at least 0, Set item top of pending to right, add 1 to top. If flip is 0 and right is at least 0, Set item top of pending to right, add 1 to top. If flip is 0 and left is at least 0, Set item top of pending to left, add 1 to top.\n\nIf failed is 1, show -1. If failed is 0 and the last position of flips is at least 0, For each value in flips, show value. If failed is 0 and the last position of flips is less than 0, show 0.\n","expected":"1\n","step_budget":2000000},{"id":972,"slug":"equal-rational-numbers","title":"Equal Rational Numbers","difficulty":"Hard","category":"String","code":"Keep a shared strings holding \"0.1(6)\" and \"0.1666(6)\". Keep a shared text as empty text. Keep a shared digits of 0. Keep a shared power of 0. Keep a shared foundpos of 0. Keep a shared upper of 0. Keep a shared lower of 0. Keep a shared firsttop of 0. Keep a shared firstbottom of 0. Keep a shared secondtop of 0. Keep a shared secondbottom of 0.\nTo finddot. Set foundpos to -1.\nFor every spot from 0 to the last position of text.\nIf character spot of text is \".\", set foundpos to spot, return.\n\nTo findopen. Set foundpos to -1.\nFor every spot from 0 to the last position of text.\nIf character spot of text is \"(\", set foundpos to spot, return.\n\nTo findclose. Set foundpos to -1.\nFor every spot from 0 to the last position of text.\nIf character spot of text is \")\", set foundpos to spot, return.\n\nTo valueof from start (a whole number) with finish (a whole number). Set digits to 0.\nFor every spot from start to finish minus 1.\nThe digit is the digit value of character spot of text. Set digits to digits times 10 plus digit.\n\nTo raiseten with count (a whole number). Set power to 1.\nRepeat while count is more than 0.\nSet power to power times 10. Subtract 1 from count.\n\nTo parse. Finddot. The dot is foundpos. Findopen. The open is foundpos. The last is the last position of text. The length is last plus 1. The whole is 0. Valueof from 0 with dot. Set whole to digits. The fractionend is open. If open is less than 0, set fractionend to length. The fractionstart is dot plus 1. Valueof from fractionstart with fractionend. The fractionpart is digits. The fractionlength is fractionend minus fractionstart. The repeating is 0. The repeatinglength is 0.\nIf open is at least 0.\nFindclose. The close is foundpos. Valueof from open plus 1 with close. Set repeating to digits. Set repeatinglength to close minus open minus 1. Raiseten with repeatinglength. The repeatingscale is power. The unit is repeatingscale minus 1. Raiseten with fractionlength. The fractionscale is power. The denominator is fractionscale times unit. The numerator is fractionpart times unit plus repeating. Set upper to whole times denominator plus numerator. Set lower to denominator.\n\nFor every spot from 0 to 1.\nSet text to item spot of strings. Parse. If spot is 0, set firsttop to upper, set firstbottom to lower. If spot is 1, set secondtop to upper, set secondbottom to lower.\n\nThe left is firsttop times secondbottom. The right is secondtop times firstbottom. If left is right, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":973,"slug":"k-closest-points-to-origin","title":"K Closest Points to Origin","difficulty":"Medium","category":"Array","code":"Keep a shared across holding 1 and -2. Keep a shared down holding 3 and 2. Keep a shared distances holding 10 and 8. Keep a shared used holding 0 and 0. Keep a shared chosen of 0. Keep a shared count of 0. Keep a shared wanted of 1.\nTo find. Set chosen to -1. The best is 1000000.\nFor every spot from 0 to the last position of across.\nIf item spot of used is 0 and item spot of distances is less than best, set best to item spot of distances, set chosen to spot.\n\nRepeat while count is less than wanted.\nFind. The target is chosen. Set item target of used to 1. The east is item target of across. The north is item target of down. The point is format whole number east as text. Place \",\" into point. The northtext is format whole number north as text. Place northtext into point. Show point. Add 1 to count.\n","expected":"-2,2\n","step_budget":2000000},{"id":974,"slug":"subarray-sums-divisible-by-k","title":"Subarray Sums Divisible by K","difficulty":"Medium","category":"Array","code":"The numbers is a list of 4, 5, 0, -2, -3, 1. The divisor is 5. The counts is a list of 5 zeros. Set item 0 of counts to 1. The total is 0. The ways is 0.\nFor each value in numbers.\nAdd value to total. The rem is total modulo divisor. If rem is less than 0, add divisor to rem. Increase ways by item rem of counts. Increase item rem of counts by 1.\n\nShow ways.\n","expected":"7\n","step_budget":2000000},{"id":975,"slug":"odd-even-jump","title":"Odd Even Jump","difficulty":"Hard","category":"Array","code":"Keep a shared values holding 10, 13, 12, 14, and 15. Keep a shared end of the last position of values. Keep a shared oddlandings as an empty list of whole numbers.\nFor every spot from 0 to end.\nPlace 0 into oddlandings.\n\nKeep a shared evenlandings as an empty list of whole numbers.\nFor every spot from 0 to end.\nPlace 0 into evenlandings.\n\nSet item end of oddlandings to 1. Set item end of evenlandings to 1. Keep a shared higher of 0. Keep a shared highervalue of 0. Keep a shared lower of 0. Keep a shared lowervalue of 0.\nTo pickodd with origin (a whole number). Set higher to -1.\nFor every spot from origin plus 1 to end.\nIf item spot of values is at least item origin of values.\nIf higher is less than 0 or item spot of values is less than highervalue or item spot of values is highervalue and spot is less than higher, set higher to spot, set highervalue to item spot of values.\n\nTo pickeven with origin (a whole number). Set lower to -1.\nFor every spot from origin plus 1 to end.\nIf item spot of values is at most item origin of values.\nIf lower is less than 0 or item spot of values is more than lowervalue or item spot of values is lowervalue and spot is less than lower, set lower to spot, set lowervalue to item spot of values.\n\nThe place is end minus 1.\nRepeat while place is at least 0.\nPickodd with place. Pickeven with place. If higher is end, set item place of oddlandings to 1. The highstep is higher. The lowstep is lower. If higher is less than end and higher is at least 0, set item place of oddlandings to item highstep of evenlandings. If lower is end, set item place of evenlandings to 1. If lower is less than end and lower is at least 0, set item place of evenlandings to item lowstep of oddlandings. Subtract 1 from place.\n\nThe good is 0.\nFor each flag in oddlandings.\nIf flag is 1, add 1 to good.\n\nShow good.\n","expected":"2\n","step_budget":2000000},{"id":976,"slug":"largest-perimeter-triangle","title":"Largest Perimeter Triangle","difficulty":"Easy","category":"Array","code":"The numbers is a list of 2, 1, 2. Sort numbers. The spot is the last position of numbers. The best is 0.\nRepeat while spot is at least 2.\nThe first is item (spot minus 2) of numbers. The second is item (spot minus 1) of numbers. The third is item spot of numbers. If first plus second is more than third, set best to first plus second plus third, stop. Subtract 1 from spot.\n\nShow best.\n","expected":"5\n","step_budget":2000000},{"id":977,"slug":"squares-of-a-sorted-array","title":"Squares of a Sorted Array","difficulty":"Easy","category":"Array","code":"The numbers is a list of -4, -1, 0, 3, and 10. The answers is a list of 5 zeros. The left is 0. The right is the last position of numbers. The spot is the last position of answers.\nRepeat while left is at most right.\nThe low is item left of numbers. The high is item right of numbers. If low times low is more than high times high, set item spot of answers to low times low, add 1 to left, otherwise set item spot of answers to high times high, subtract 1 from right. Subtract 1 from spot.\n\nFor each value in answers, show value.\n","expected":"0\n1\n9\n16\n100\n","step_budget":2000000},{"id":978,"slug":"longest-turbulent-subarray","title":"Longest Turbulent Subarray","difficulty":"Medium","category":"Array","code":"The numbers is a list of 9, 4, 2, 10, 7, 8, 8, 1, and 9. The rising is 0. The falling is 0. The best is 1.\nFor every spot from 1 to the last position of numbers.\nThe before is item (spot minus 1) of numbers. The here is item spot of numbers. If here is more than before, set rising to falling plus 1, set falling to 0. If here is less than before, set falling to rising plus 1, set rising to 0. If here is before, set rising to 0, set falling to 0. If rising plus 1 is more than best, set best to rising plus 1. If falling plus 1 is more than best, set best to falling plus 1.\n\nShow best.\n","expected":"5\n","step_budget":2000000},{"id":979,"slug":"distribute-coins-in-binary-tree","title":"Distribute Coins in Binary Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 0, 3, and 0. Keep a shared lefts holding 1, -1, and -1. Keep a shared rights holding 2, -1, and -1. Keep a shared moves of 0. Keep a shared flow of 0.\n\nTo settle from node (a whole number). If node is less than 0, set flow to 0, return. Settle from item node of lefts. The leftshare is flow. Settle from item node of rights. The rightshare is flow. The surplus is item node of values plus leftshare plus rightshare minus 1. Set flow to surplus. The gap is the absolute value of surplus. Increase moves by gap.\n\nSettle from 0. Show moves.\n","expected":"3\n","step_budget":2000000},{"id":980,"slug":"unique-paths-iii","title":"Unique Paths III","difficulty":"Hard","category":"Array","code":"Keep a shared board holding 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, and -1. Keep a shared visited as a list of 12 zeros. Keep a shared height of 3. Keep a shared width of 4. Keep a shared target of 10. Keep a shared walkable of 11. Keep a shared paths of 0. Set item 0 of visited to 1.\n\nTo seek from other (a whole number) with seen (a whole number). If other is less than 0, return. If other is at least 12, return. If item other of board is -1, return. If item other of visited is 1, return. Set item other of visited to 1. Explore from other with seen plus 1. Set item other of visited to 0.\n\nTo explore from place (a whole number) with seen (a whole number). If place is target and seen is walkable, add 1 to paths. If place is target, return. The band is place divided by width. The file is place modulo width. If file is more than 0, seek from (place minus 1) with seen. If file is less than width minus 1, seek from (place plus 1) with seen. If band is more than 0, seek from (place minus width) with seen. If band is less than height minus 1, seek from (place plus width) with seen.\n\nExplore from 0 with 1. Show paths.\n","expected":"2\n","step_budget":2000000},{"id":982,"slug":"triples-with-bitwise-and-equal-to-zero","title":"Triples with Bitwise AND Equal To Zero","difficulty":"Hard","category":"Array","code":"The numbers is a list of 2, 1, and 3. The total is 0.\nFor every first from 0 to the last position of numbers.\nFor every second from 0 to the last position of numbers.\nFor every third from 0 to the last position of numbers.\nThe pair is bitwise and of item first of numbers and item second of numbers. The whole is bitwise and of pair and item third of numbers. If whole is 0, add 1 to total.\n\nShow total.\n","expected":"12\n","step_budget":2000000},{"id":983,"slug":"minimum-cost-for-tickets","title":"Minimum Cost For Tickets","difficulty":"Medium","category":"Array","code":"Keep a shared days holding 1, 4, 6, 7, 8, and 20. Keep a shared prices holding 2, 7, and 15. Keep a shared travel as an empty list of whole numbers. Keep a shared table as an empty list of whole numbers. For every slot from 0 to 30, Place 0 into travel. For every slot from 0 to 30, Place 0 into table. For each day in days, set item day of travel to 1.\n\nTo fill from date (a whole number). If item date of travel is 0, set item date of table to item (date minus 1) of table, return. The week is date minus 7. If week is less than 0, set week to 0. The month is date minus 30. If month is less than 0, set month to 0. The single is item (date minus 1) of table plus item 0 of prices. The span is item week of table plus item 1 of prices. The longspan is item month of table plus item 2 of prices. The best is the smaller of single and span. The finest is the smaller of best and longspan. Set item date of table to finest.\n\nFor every date from 1 to 20, fill from date. Show item 20 of table.\n","expected":"11\n","step_budget":2000000},{"id":984,"slug":"string-without-aaa-or-bbb","title":"String Without AAA or BBB","difficulty":"Medium","category":"String","code":"The acount is 4. The bcount is 1. The text is empty text. The prior is 0. The streak is 0.\nRepeat while acount plus bcount is more than 0.\nThe side is 1. If acount is less than bcount, set side to 2. If side is prior and streak is 2, if side is 1, set side to 2, otherwise set side to 1. If side is 1, subtract 1 from acount. If side is 2, subtract 1 from bcount. If side is prior, add 1 to streak, otherwise set prior to side, set streak to 1. If side is 1, Place \"a\" into text, otherwise Place \"b\" into text.\n\nShow text.\n","expected":"aabaa\n","step_budget":2000000},{"id":985,"slug":"sum-of-even-numbers-after-queries","title":"Sum of Even Numbers After Queries","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 2, 3, and 4. The values is a list of 1, -3, -4, and 2. The spots is a list of 0, 1, 0, and 3. The total is 0. For each number in numbers, if number modulo 2 is 0, add number to total.\nFor every which from 0 to the last position of values.\nThe spot is item which of spots. The oldvalue is item spot of numbers. If oldvalue modulo 2 is 0, subtract oldvalue from total. Set item spot of numbers to oldvalue plus item which of values. The fresh is item spot of numbers. If fresh modulo 2 is 0, add fresh to total. Show total.\n","expected":"8\n6\n2\n4\n","step_budget":2000000},{"id":986,"slug":"interval-list-intersections","title":"Interval List Intersections","difficulty":"Medium","category":"Array","code":"The firststarts is a list of 0, 5, 13, and 24. The firstends is a list of 2, 10, 23, and 25. The secondstarts is a list of 1, 8, 15, and 25. The secondends is a list of 5, 12, 24, and 26. The first is 0. The second is 0. The found is 0.\nRepeat while first is at most the last position of firststarts and second is at most the last position of secondstarts.\nThe low is item first of firststarts. If item second of secondstarts is more than low, set low to item second of secondstarts. The high is item first of firstends. If item second of secondends is less than high, set high to item second of secondends. The firstend is item first of firstends. The secondend is item second of secondends. If firstend is less than secondend, add 1 to first, otherwise add 1 to second.\nIf low is at most high.\nIf found is more than 0, show \"---\". Show low. Show high. Add 1 to found.\n","expected":"1\n2\n---\n5\n5\n---\n8\n10\n---\n15\n23\n---\n24\n24\n---\n25\n25\n","step_budget":2000000},{"id":987,"slug":"vertical-order-traversal-of-a-binary-tree","title":"Vertical Order Traversal of a Binary Tree","difficulty":"Hard","category":"Sorting","code":"Keep a shared labels holding 3, 9, 20, 15, and 7. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, 4, -1, and -1. Keep a shared order as an empty list of whole numbers. Keep a shared keys as an empty list of whole numbers. Keep a shared shown of 0. Keep a shared seen of 0.\n\nTo gather from node (a whole number) with code (a whole number). If node is less than 0, return. The column is code divided by 10000 minus 1000. The depth is code modulo 10000. Place item node of labels into order. The key is (column plus 1000) times 100000000 plus depth times 10000 plus item node of labels. Place key into keys. Gather from item node of lefts with (code minus 10000). Gather from item node of rights with (code plus 10000).\n\nGather from 0 with 10000000.\nFor every spot from 1 to the last position of keys.\nThe hold is item spot of keys. The keep is item spot of order. The prior is spot minus 1.\nRepeat while prior is at least 0 and item prior of keys is more than hold.\nSet item (prior plus 1) of keys to item prior of keys. Set item (prior plus 1) of order to item prior of order. Subtract 1 from prior. Set item (prior plus 1) of keys to hold. Set item (prior plus 1) of order to keep.\n\nFor every spot from 0 to the last position of keys.\nThe packed is item spot of keys. The column is packed divided by 100000000 minus 1000. If seen is more than 0 and column is not shown, show \"---\". Show item spot of order. Set shown to column. Add 1 to seen.\n","expected":"9\n---\n3\n15\n---\n20\n---\n7\n","step_budget":2000000},{"id":988,"slug":"smallest-string-starting-from-leaf","title":"Smallest String Starting From Leaf","difficulty":"Medium","category":"String","code":"Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared labels holding 0, 1, 2, 3, 4, 3, and 4. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1. Keep a shared trail as an empty list of text. Keep a shared bestpath as an empty list of text. Keep a shared final as empty text. Keep a shared have of 0. Keep a shared smaller of 0.\n\nTo drain. The count is the number of items in bestpath.\nRepeat while count is more than 0.\nremove the last item from bestpath. Subtract 1 from count.\n\nTo record. For each piece in trail, The saved is a copy of piece, Place saved into bestpath.\n\nTo store. Drain. Record.\n\nTo compare. Set smaller to 0. The spot is the last position of trail. The other is the last position of bestpath.\nRepeat while spot is at least 0 and other is at least 0.\nThe left is item spot of trail. The right is item other of bestpath. If left comes before right, set smaller to 1, return. If right comes before left, return. Subtract 1 from spot. Subtract 1 from other.\n\nTo visit. If have is 0, store, set have to 1, return. Compare. If smaller is 1, store.\n\nTo report. The spot is the last position of bestpath.\nRepeat while spot is at least 0.\nPlace item spot of bestpath into final. Subtract 1 from spot.\n\nTo look from node (a whole number). If node is less than 0, return. The piece is the slice of alphabet from item node of labels to item node of labels plus 1. The held is a copy of piece. Place held into trail. If item node of lefts is less than 0 and item node of rights is less than 0, visit. Look from item node of lefts. Look from item node of rights. Remove the last item from trail.\n\nLook from 0. Report. Show final.\n","expected":"dba\n","step_budget":2000000},{"id":989,"slug":"add-to-array-form-of-integer","title":"Add to Array-Form of Integer","difficulty":"Easy","category":"Array","code":"The digits is a list of 1, 2, 0, and 0. The extra is 34. The answers is an empty list of whole numbers. The spot is the last position of digits. The carry is extra.\nRepeat while spot is at least 0 or carry is more than 0.\nIf spot is at least 0, The sum is item spot of digits plus carry, Place (sum modulo 10) into answers, set carry to sum divided by 10. If spot is less than 0, Place (carry modulo 10) into answers, set carry to carry divided by 10. Subtract 1 from spot.\n\nThe spot is the last position of answers.\nRepeat while spot is at least 0.\nShow item spot of answers. Subtract 1 from spot.\n","expected":"1\n2\n3\n4\n","step_budget":2000000},{"id":990,"slug":"satisfiability-of-equality-equations","title":"Satisfiability of Equality Equations","difficulty":"Medium","category":"Array","code":"Keep a shared rules holding \"a==b\", \"b!=c\", and \"c==a\". Keep a shared parent as an empty list of whole numbers. For every slot from 0 to 25, Place slot into parent. Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared letter as empty text. Keep a shared leftpairs as an empty list of whole numbers. Keep a shared rightpairs as an empty list of whole numbers. Keep a shared slot of 0. Keep a shared ancestor of 0. Keep a shared valid of 1.\n\nTo locate. Set slot to 0. The current is slot.\nRepeat while current is less than 26.\nThe symbol is the slice of alphabet from current to current plus 1. If symbol matches letter, set slot to current, stop. Add 1 to current.\n\nTo find from place (a whole number). Set ancestor to place. The current is ancestor.\nRepeat while item current of parent is not current.\nThe next is item current of parent. Set current to next. Set ancestor to next.\n\nTo connect from first (a whole number) with second (a whole number). Find from first. The leftroot is ancestor. Find from second. The rightroot is ancestor. If leftroot is not rightroot, set item leftroot of parent to rightroot.\n\nTo check from first (a whole number) with second (a whole number). Find from first. The leftroot is ancestor. Find from second. The rightroot is ancestor. If leftroot is rightroot, set valid to 0.\n\nFor each rule in rules.\nThe leftletter is the slice of rule from 0 to 1. The mark is the slice of rule from 1 to 2. The rightletter is the slice of rule from 3 to 4. Set letter to leftletter. Locate. The leftslot is slot. Set letter to rightletter. Locate. The rightslot is slot. If mark matches \"=\", connect from leftslot with rightslot, otherwise Place leftslot into leftpairs, Place rightslot into rightpairs.\n\nFor every which from 0 to the last position of leftpairs.\nThe one is item which of leftpairs. The two is item which of rightpairs. Check from one with two.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":991,"slug":"broken-calculator","title":"Broken Calculator","difficulty":"Medium","category":"Math","code":"The start is 2, while the target is 3. The steps is 0, while the current is target.\nRepeat while current is more than start.\nIf current modulo 2 is 0 and current divided by 2 is at least start, set current to current divided by 2. Otherwise, set current to current plus 1. Add 1 to steps.\n\nIncrease steps by current minus start. Show steps.\n","expected":"2\n","step_budget":2000000},{"id":992,"slug":"subarrays-with-k-different-integers","title":"Subarrays with K Different Integers","difficulty":"Hard","category":"Array","code":"Keep a shared numbers holding 1, 2, 1, 2, and 3. Keep a shared counts as a list of 6 zeros. Keep a shared limit of 0. Keep a shared beginning of 0. Keep a shared distinct of 0. Keep a shared total of 0. Keep a shared window of 0.\n\nTo wipe. For every spot from 0 to 5, set item spot of counts to 0.\n\nTo tighten from right (a whole number).\nRepeat while distinct is more than limit.\nThe position is beginning. The old is item position of numbers. Decrease item old of counts by 1. If item old of counts is 0, set distinct to distinct minus 1. Increase beginning by 1. Set window to right minus beginning plus 1.\n\nTo tally with bound (a whole number). Set limit to bound. Wipe. Set total to 0. Set beginning to 0. Set distinct to 0.\nFor every right from 0 to 4.\nThe value is item right of numbers. If item value of counts is 0, add 1 to distinct. Increase item value of counts by 1. Set window to right minus beginning plus 1. Tighten from right. Increase total by window.\n\nTally with 2. The high is total. Tally with 1. The low is total. Show high minus low.\n","expected":"7\n","step_budget":2000000},{"id":993,"slug":"cousins-in-binary-tree","title":"Cousins in Binary Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, 4, and 5. Keep a shared lefts holding 1, -1, -1, -1, and -1. Keep a shared rights holding 2, 3, 4, -1, and -1. Keep a shared depths as an empty list of whole numbers. Keep a shared parents as an empty list of whole numbers. For every spot from 0 to 4, Place 0 into depths. For every spot from 0 to 4, Place 0 into parents.\n\nTo walk from node (a whole number) with parent (a whole number) and level (a whole number). If node is less than 0, return. Set item node of depths to level. Set item node of parents to parent. Walk from item node of lefts with node and level plus 1. Walk from item node of rights with node and level plus 1.\n\nWalk from 0 with -1 and 0. The first is -1, while the second is -1.\nFor every spot from 0 to 4.\nIf item spot of values is 4, set second to spot. If item spot of values is 5, set first to spot.\n\nThe verdict is 0. If item first of depths is item second of depths and item first of parents is not item second of parents, set verdict to 1. If verdict is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":994,"slug":"rotting-oranges","title":"Rotting Oranges","difficulty":"Medium","category":"Array","code":"Keep a shared grid holding 2, 1, 1, 1, 1, 0, 0, 1, and 1. Keep a shared distances as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. For every cell from 0 to 8, Place 0 into distances. For every cell from 0 to 8, Place 0 into queue. Keep a shared fresh of 0. Keep a shared count of 0.\nFor every cell from 0 to 8.\nIf item cell of grid is 1, add 1 to fresh. If item cell of grid is 2, set item count of queue to cell, add 1 to count.\n\nTo spread from node (a whole number). The offsets is a list of -3, 3, -1, and 1. The row is node divided by 3, while the column is node modulo 3.\nFor every which from 0 to 3.\nThe offset is item which of offsets. The target is node plus offset. The level is item node of distances plus 1. The open is 1. If which is 0 and row is 0, set open to 0. If which is 1 and row is 2, set open to 0. If which is 2 and column is 0, set open to 0. If which is 3 and column is 2, set open to 0.\nIf open is 1 and item target of grid is 1.\nSet item target of grid to 2. Set item target of distances to level. Set item count of queue to target. Add 1 to count. Decrease fresh by 1.\n\nThe head is 0.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Spread from node.\n\nThe best is 0.\nFor every cell from 0 to 8.\nIf item cell of distances is more than best, set best to item cell of distances.\n\nIf fresh is more than 0, show -1, otherwise show best.\n","expected":"4\n","step_budget":2000000},{"id":995,"slug":"minimum-number-of-k-consecutive-bit-flips","title":"Minimum Number of K Consecutive Bit Flips","difficulty":"Hard","category":"Array","code":"The bits is a list of 0, 0, 0, 1, 0, 1, 1, and 0. The ends is a list of 9 zeros. The size is 8, while the span is 3. The flips is 0, while the active is 0, while the impossible is 0.\nFor every spot from 0 to size minus 1.\nIf item spot of ends is 1, set active to 1 minus active. The value is item spot of bits. If active is 1, set value to 1 minus value.\nIf value is 0 and spot plus span is at most size.\nSet item (spot plus span) of ends to 1. Add 1 to flips. Set active to 1 minus active.\nIf value is 0 and spot plus span is more than size.\nSet impossible to 1.\n\nIf impossible is 1, show -1, otherwise show flips.\n","expected":"3\n","step_budget":2000000},{"id":996,"slug":"number-of-squareful-arrays","title":"Number of Squareful Arrays","difficulty":"Hard","category":"Array","code":"Keep a shared numbers holding 1, 17, and 8. Sort numbers. Keep a shared used as an empty list of whole numbers. Keep a shared order as an empty list of whole numbers. For every spot from 0 to 2, Place 0 into used. For every spot from 0 to 2, Place 0 into order. Keep a shared squares holding 1, 4, 9, 16, 25, and 36. Keep a shared total of 0.\n\nTo seed.\nFor every spot from 0 to 2.\nIf item spot of used is 1, skip to the next one. If spot is more than 0 and item spot of numbers is item (spot minus 1) of numbers and item (spot minus 1) of used is 0, skip to the next one. Set item 0 of order to item spot of numbers. Set item spot of used to 1. Extend from 1. Set item spot of used to 0.\n\nTo extend from depth (a whole number). If depth is 3, add 1 to total, return.\nFor every spot from 0 to 2.\nIf item spot of used is 1, skip to the next one. If spot is more than 0 and item spot of numbers is item (spot minus 1) of numbers and item (spot minus 1) of used is 0, skip to the next one. The previous is item (depth minus 1) of order. The candidate is previous plus item spot of numbers. If squares does not contain candidate, skip to the next one. Set item depth of order to item spot of numbers. Set item spot of used to 1. Extend from depth plus 1. Set item spot of used to 0.\n\nSeed. Show total.\n","expected":"2\n","step_budget":2000000},{"id":997,"slug":"find-the-town-judge","title":"Find the Town Judge","difficulty":"Easy","category":"Array","code":"The trust is a list of 1, 3, 2, and 3. The scores is a list of 4 zeros.\nFor every pair from 0 to 1.\nThe giver is item (pair times 2) of trust. The taker is item (pair times 2 plus 1) of trust. Decrease item giver of scores by 1. Increase item taker of scores by 1.\n\nThe judge is -1.\nFor every person from 1 to 3.\nIf item person of scores is 2, set judge to person.\n\nShow judge.\n","expected":"3\n","step_budget":2000000},{"id":998,"slug":"maximum-binary-tree-ii","title":"Maximum Binary Tree II","difficulty":"Medium","category":"Tree","code":"Keep a shared values holding 4, 1, 3, 2, and 0. Keep a shared lefts holding 1, -1, 3, -1, and -1. Keep a shared rights holding 2, -1, -1, -1, and -1. Keep a shared desired of 5. Keep a shared spot of 0.\n\nTo descend from current (a whole number). Set spot to current. The right is item current of rights. If right is at least 0 and item right of values is more than desired, Descend from right.\n\nThe root is 0.\nIf desired is more than item 0 of values.\nSet item 4 of values to desired. Set item 4 of lefts to root. Set item 4 of rights to -1. Set root to 4.\n\nIf desired is at most item 0 of values.\nDescend from 0. The branch is spot. The hole is item branch of rights. Set item 4 of values to desired. Set item 4 of lefts to hole. Set item 4 of rights to -1. Set item branch of rights to 4.\n\nThe queue is a list of 16 zeros. Set item 0 of queue to root. The head is 0, while the count is 1. The order is an empty list of whole numbers.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. If node is less than 0, Place -1 into order.\nIf node is at least 0.\nPlace item node of values into order. Set item count of queue to item node of lefts. Add 1 to count. Set item count of queue to item node of rights. Add 1 to count.\n\nThe cut is the last position of order.\nRepeat while cut is at least 0 and item cut of order is -1.\nDecrease cut by 1.\n\nFor every spot from 0 to cut.\nShow item spot of order.\n","expected":"5\n4\n-1\n1\n3\n-1\n-1\n2\n","step_budget":2000000},{"id":999,"slug":"available-captures-for-rook","title":"Available Captures for Rook","difficulty":"Easy","category":"Array","code":"Keep a shared board holding \"...p....\", \"...p....\", \"........\", \".p.R..p.\", \"........\", \"...p....\", \"........\", and \"........\". Keep a shared captures of 0.\n\nTo sweep from spot (a whole number) with step (a whole number) and steps (a whole number). The cursor is spot plus step, while remaining is steps, while open is 0.\nRepeat while remaining is more than 0 and open is 0.\nThe row is cursor divided by 8, while the column is cursor modulo 8. The line is item row of board. The symbol is the slice of line from column to column plus 1. If symbol matches \"p\", add 1 to captures, set open to 1. If symbol matches \"R\", set open to 1. Increase cursor by step. Decrease remaining by 1.\n\nThe rook is -1.\nFor every spot from 0 to 63.\nThe row is spot divided by 8, while the column is spot modulo 8. The line is item row of board. The symbol is the slice of line from column to column plus 1. If symbol matches \"R\", set rook to spot.\n\nThe rank is rook divided by 8, while the file is rook modulo 8. Sweep from rook with -8 and rank. Sweep from rook with 8 and 7 minus rank. Sweep from rook with -1 and file. Sweep from rook with 1 and 7 minus file. Show captures.\n","expected":"4\n","step_budget":2000000},{"id":1000,"slug":"minimum-cost-to-merge-stones","title":"Minimum Cost to Merge Stones","difficulty":"Hard","category":"Array","code":"The stones is a list of 3, 2, 4, and 1. The prefix is a list of 5 zeros.\nFor every spot from 0 to 3.\nSet item (spot plus 1) of prefix to item spot of prefix plus item spot of stones.\n\nThe table is a list of 16 zeros.\nFor every length from 2 to 4.\nFor every start from 0 to 4 minus length.\nThe finish is start plus length minus 1. The cell is start times 4 plus finish. The before is item start of prefix, while the after is item (finish plus 1) of prefix. The range is after minus before. Set item cell of table to 1000000.\nFor every split from start to finish minus 1.\nThe beyond is split plus 1. The leftcell is start times 4 plus split. The rightcell is beyond times 4 plus finish. The candidate is item leftcell of table plus item rightcell of table plus range. If candidate is less than item cell of table, set item cell of table to candidate.\n\nShow item 3 of table.\n","expected":"20\n","step_budget":2000000},{"id":1001,"slug":"grid-illumination","title":"Grid Illumination","difficulty":"Hard","category":"Array","code":"The lamp rows is a list of 0 and 4. The lamp columns is a list of 0 and 4. The lit is a list of 1 and 1. The query rows is a list of 1 and 1. The query columns is a list of 1 and 0. The answers is an empty list of whole numbers.\nFor every query from 0 to 1.\nThe target row is item query of query rows. The target column is item query of query columns. The glowing is 0.\nFor every lamp from 0 to 1.\nIf item lamp of lit is 1 and item lamp of lamp rows is target row, set glowing to 1. If item lamp of lit is 1 and item lamp of lamp columns is target column, set glowing to 1. The row gap is the absolute value of (item lamp of lamp rows minus target row). The column gap is the absolute value of (item lamp of lamp columns minus target column). If item lamp of lit is 1 and row gap is column gap, set glowing to 1. If item lamp of lit is 1 and row gap is at most 1 and column gap is at most 1, set item lamp of lit to 0. If lamp is 1, Place glowing into answers.\n\nThe line is empty text.\nFor each answer in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number answer as text into line.\n\nShow line.\n","expected":"1,0\n","step_budget":2000000},{"id":1002,"slug":"find-common-characters","title":"Find Common Characters","difficulty":"Easy","category":"Array","code":"Keep a shared words as an empty list of text. Keep a shared alphabet as empty text. Keep a shared tally of 0. Place \"bella\" into words. Place \"label\" into words. Place \"roller\" into words. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet.\n\nTo measure from index (a whole number) with letter (a whole number). The word is item index of words. The symbol is the slice of alphabet from letter to letter plus 1. Set tally to 0.\nFor every spot from 0 to the last position of word.\nThe piece is the slice of word from spot to spot plus 1. If piece matches symbol, add 1 to tally.\n\nThe least is a list of 26 zeros.\nFor every letter from 0 to 25.\nThe smallest is 100.\nFor every index from 0 to 2.\nMeasure from index with letter. If tally is less than smallest, set smallest to tally. If index is 2, set item letter of least to smallest.\n\nThe found is an empty list of text.\nFor every letter from 0 to 25.\nFor every copy from 0 to item letter of least minus 1.\nThe piece is the slice of alphabet from letter to letter plus 1. Place piece into found.\n\nThe line is empty text.\nFor each piece in found.\nIf the length of line is more than 0, Place \",\" into line. Place piece into line.\n\nShow line.\n","expected":"e,l,l\n","step_budget":8550382},{"id":1003,"slug":"check-if-word-is-valid-after-substitutions","title":"Check If Word Is Valid After Substitutions","difficulty":"Medium","category":"String","code":"The source is \"aabcbc\". The stack is an empty list of text.\nFor every spot from 0 to the last position of source.\nThe symbol is the slice of source from spot to spot plus 1. Place symbol into stack. The size is the number of items in stack.\nIf size is at least 3.\nThe bottom is item (size minus 3) of stack. The middle is item (size minus 2) of stack. The top is item (size minus 1) of stack. The formed is 0. If bottom matches \"a\", add 1 to formed. If middle matches \"b\", add 1 to formed. If top matches \"c\", add 1 to formed. If formed is 3, remove the last item from stack, remove the last item from stack, remove the last item from stack.\n\nThe remaining is the number of items in stack. If remaining is 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1004,"slug":"max-consecutive-ones-iii","title":"Max Consecutive Ones III","difficulty":"Medium","category":"Array","code":"Keep a shared bits as an empty list of whole numbers. Keep a shared limit of 0. Keep a shared opening of 0. Keep a shared zeros of 0. Keep a shared best of 0.\n\nTo shrink from spot (a whole number).\nRepeat while zeros is more than limit.\nIf item spot of bits is 0, subtract 1 from zeros. Add 1 to spot. Set opening to spot.\n\nSet limit to 2. Place 1 into bits. Place 1 into bits. Place 1 into bits. Place 0 into bits. Place 0 into bits. Place 0 into bits. Place 1 into bits. Place 1 into bits. Place 1 into bits. Place 1 into bits. Place 0 into bits.\nFor every right from 0 to the last position of bits.\nIf item right of bits is 0, add 1 to zeros. Shrink from opening. The width is right minus opening plus 1. If width is more than best, set best to width.\n\nShow best.\n","expected":"6\n","step_budget":2000000},{"id":1005,"slug":"maximize-sum-of-array-after-k-negations","title":"Maximize Sum Of Array After K Negations","difficulty":"Easy","category":"Array","code":"The scores is a list of 3, -1, 0, and 2. The budget is 3. Sort scores.\nFor every spot from 0 to the last position of scores.\nIf budget is more than 0 and item spot of scores is less than 0, set item spot of scores to 0 minus item spot of scores, subtract 1 from budget.\n\nThe smallest is item 0 of scores.\nFor every spot from 1 to the last position of scores.\nIf item spot of scores is less than smallest, set smallest to item spot of scores.\n\nThe total is 0.\nFor each value in scores.\nAdd value to total.\n\nThe penalty is smallest plus smallest. If budget modulo 2 is 1, subtract penalty from total.\n\nShow total.\n","expected":"6\n","step_budget":2000000},{"id":1006,"slug":"clumsy-factorial","title":"Clumsy Factorial","difficulty":"Medium","category":"Math","code":"The count is 10. The stack is an empty list of whole numbers. Place count into stack. The spot is count minus 1. The phase is 0.\nRepeat while spot is at least 1.\nThe size is the number of items in stack. The top is item (size minus 1) of stack. If phase is 0, set item (size minus 1) of stack to top times spot. If phase is 1, set item (size minus 1) of stack to top divided by spot. If phase is 2, Place spot into stack. If phase is 3, Place 0 minus spot into stack. Set phase to (phase plus 1) modulo 4. Decrease spot by 1.\n\nThe total is 0.\nFor each entry in stack.\nAdd entry to total.\n\nShow total.\n","expected":"12\n","step_budget":2000000},{"id":1007,"slug":"minimum-domino-rotations-for-equal-row","title":"Minimum Domino Rotations For Equal Row","difficulty":"Medium","category":"Array","code":"Keep a shared tops holding 2, 1, 2, 4, 2, and 2. Keep a shared bottoms holding 5, 2, 6, 2, 3, and 2. Keep a shared best of 0.\n\nTo check with candidate (a whole number). The possible is 1. The topcost is 0. The bottomcost is 0.\nFor every spot from 0 to 5.\nIf item spot of tops is not candidate and item spot of bottoms is not candidate, set possible to 0. If item spot of tops is not candidate, add 1 to topcost. If item spot of bottoms is not candidate, add 1 to bottomcost. If spot is 5, The take is the smaller of topcost and bottomcost, If possible is 1 and take is less than best, set best to take.\n\nSet best to 100. The firsttop is item 0 of tops. The firstbottom is item 0 of bottoms. Check with firsttop. Check with firstbottom. If best is 100, show -1, otherwise show best.\n","expected":"2\n","step_budget":2000000},{"id":1008,"slug":"construct-binary-search-tree-from-preorder-traversal","title":"Construct Binary Search Tree from Preorder Traversal","difficulty":"Medium","category":"Array","code":"Keep a shared preorder holding 8, 5, 1, 7, 10, and 12. Keep a shared lefts holding -1, -1, -1, -1, -1, and -1. Keep a shared rights holding -1, -1, -1, -1, -1, and -1. Keep a shared next slot as 0. Keep a shared child of 0.\n\nTo build from bound (a whole number). Set child to -1. If next slot is more than the last position of preorder, return. The slot is next slot. The current is item slot of preorder. If current is more than bound, return. Add 1 to next slot. Build from current. Set item slot of lefts to child. Build from bound. Set item slot of rights to child. Set child to slot.\n\nBuild from 1000000. The queue is an empty list of whole numbers. The order is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Place node into order. If node is at least 0, Place item node of lefts into queue, Place item node of rights into queue, add 2 to count.\n\nThe pieces is an empty list of text.\nFor each node in order.\nIf node is less than 0, Place \"null\" into pieces, otherwise The piece is format whole number item node of preorder as text, Place piece into pieces.\n\nThe tail is the last position of pieces.\nRepeat while tail is at least 0.\nIf item tail of pieces matches \"null\", remove the last item from pieces, set tail to tail minus 1, otherwise stop.\n\nThe line is join pieces with \",\". Show line.\n","expected":"8,5,10,1,7,null,12\n","step_budget":2000000},{"id":1009,"slug":"complement-of-base-10-integer","title":"Complement of Base 10 Integer","difficulty":"Easy","category":"Bit Manipulation","code":"The number is 5. The rest is number. The power is 1.\nRepeat while rest is more than 0.\nSet power to power times 2. Set rest to rest divided by 2.\n\nThe mask is power minus 1. The answer is mask minus number. Show answer.\n","expected":"2\n","step_budget":2000000},{"id":1010,"slug":"pairs-of-songs-with-total-durations-divisible-by-60","title":"Pairs of Songs With Total Durations Divisible by 60","difficulty":"Medium","category":"Array","code":"The lengths is a list of 30, 20, 150, 100, and 40. The remainders is a list of 60 zeros. The total is 0.\nFor every spot from 0 to the last position of lengths.\nThe rest is item spot of lengths modulo 60. The partner is 0. If rest is not 0, set partner to 60 minus rest. Increase total by item partner of remainders. Increase item rest of remainders by 1.\n\nShow total.\n","expected":"3\n","step_budget":2000000},{"id":1011,"slug":"capacity-to-ship-packages-within-d-days","title":"Capacity To Ship Packages Within D Days","difficulty":"Medium","category":"Array","code":"Keep a shared weights holding 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10. Keep a shared days of 0. Keep a shared fits of 0.\n\nTo test with capacity (a whole number). Set fits to 1. The used is 0. The needed is 1.\nFor every spot from 0 to the last position of weights.\nThe parcel is item spot of weights. If used plus parcel is more than capacity, add 1 to needed, set used to 0. Add parcel to used. If needed is more than days, set fits to 0, stop.\n\nSet days to 5. The low is 1.\nFor each parcel in weights.\nIf parcel is more than low, set low to parcel.\n\nThe high is 0.\nFor each parcel in weights.\nAdd parcel to high.\n\nRepeat while low is less than high.\nThe middle is the midpoint of low and high. Test with middle. If fits is 1, set high to middle, otherwise set low to middle plus 1.\n\nShow low.\n","expected":"15\n","step_budget":2000000},{"id":1012,"slug":"numbers-with-repeated-digits","title":"Numbers With Repeated Digits","difficulty":"Hard","category":"Math","code":"Keep a shared duplicated of 0.\n\nTo screen from number (a whole number). Set duplicated to 0. If number is 0, return. The seen is a list of 10 zeros. The rest is number.\nRepeat while rest is more than 0.\nThe digit is rest modulo 10. If item digit of seen is 1, set duplicated to 1. Set item digit of seen to 1. Set rest to rest divided by 10.\n\nThe limit is 100. The total is 0.\nFor every number from 0 to limit.\nScreen from number. If duplicated is 1, add 1 to total.\n\nShow total.\n","expected":"10\n","step_budget":2000000},{"id":1013,"slug":"partition-array-into-three-parts-with-equal-sum","title":"Partition Array Into Three Parts With Equal Sum","difficulty":"Easy","category":"Array","code":"The numbers is a list of 0, 2, 1, -6, 6, -7, 9, 1, 2, 0, and 1. The total is 0.\nFor each value in numbers.\nAdd value to total.\n\nThe target is 0. If total modulo 3 is 0, set target to total divided by 3. The valid is 0.\nIf total modulo 3 is 0.\nThe running is 0. The finish is the last position of numbers. The cuts is 0.\nFor every spot from 0 to the last position of numbers.\nIncrease running by item spot of numbers. If running is target and cuts is less than 2 and spot is less than finish, add 1 to cuts, set running to 0. If spot is finish and cuts is 2 and running is target, set valid to 1.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1014,"slug":"best-sightseeing-pair","title":"Best Sightseeing Pair","difficulty":"Medium","category":"Array","code":"The values is a list of 8, 1, 5, 2, and 6. The best is 0. The carry is item 0 of values.\nFor every spot from 1 to the last position of values.\nThe candidate is carry plus item spot of values minus spot. If candidate is more than best, set best to candidate. The offer is item spot of values plus spot. If offer is more than carry, set carry to offer.\n\nShow best.\n","expected":"11\n","step_budget":2000000},{"id":1015,"slug":"smallest-integer-divisible-by-k","title":"Smallest Integer Divisible by K","difficulty":"Medium","category":"Math","code":"The divisor is 3. The remainder is 0. The length is 0. The answer is -1.\nRepeat while length is less than divisor and answer is less than 0.\nAdd 1 to length. Set remainder to (remainder times 10 plus 1) modulo divisor. If remainder is 0, set answer to length.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":1016,"slug":"binary-string-with-substrings-representing-1-to-n","title":"Binary String With Substrings Representing 1 To N","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Keep a shared parts as an empty list of text. Keep a shared encoded as empty text. Keep a shared found of 0. Keep a shared powers as an empty list of whole numbers. Keep a shared limit of 0.\n\nTo erase.\nRepeat while the last position of parts is at least 0.\nRemove the last item from parts.\n\nTo encode from number (a whole number) with power (a whole number). The rest is number.\nRepeat while power is more than 0.\nThe bit is 0. If rest is at least power, set bit to 1, set rest to rest minus power. The piece is format whole number bit as text. Place piece into parts. Set power to power divided by 2.\n\nTo assemble. Set found to 0. Set encoded to join parts with \"\".\n\nTo seek from marker (a whole number). The lastpiece is the last position of encoded. The size is lastpiece plus 1. The lastsource is the last position of source. The endmark is lastsource plus 1. The final is endmark minus size plus 1.\nFor every start from 0 to final.\nThe piece is the slice of source from start to start plus size. If piece is encoded, set found to 1.\n\nSet limit to 3. Place \"0110\" into source. The powers is a list of 4 zeros. Set item 1 of powers to 1.\nFor every number from 1 to limit.\nThe power is 1.\nRepeat while power times 2 is at most number.\nSet power to power times 2. If power times 2 is more than number, set item number of powers to power.\n\nThe valid is 1.\nFor every number from 1 to limit.\nThe power is item number of powers. Erase. Encode from number with power. Assemble. Seek from 0. If found is 0, set valid to 0.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1017,"slug":"convert-to-base-2","title":"Convert to Base -2","difficulty":"Medium","category":"Math","code":"The number is 2. The rest is number. The reversed is an empty list of text.\nRepeat while rest is not 0.\nThe bit is rest modulo 2. If bit is less than 0, set bit to 0 minus bit. The piece is format whole number bit as text. Place piece into reversed. The adjusted is rest minus bit. Set rest to adjusted divided by -2.\n\nThe result is empty text. The last is the last position of reversed.\nFor every step from 0 to last.\nThe place is last minus step. Place item place of reversed into result.\n\nShow result.\n","expected":"110\n","step_budget":2000000},{"id":1018,"slug":"binary-prefix-divisible-by-5","title":"Binary Prefix Divisible By 5","difficulty":"Easy","category":"Array","code":"The bits is a list of 0, 1, and 1. The answers is an empty list of text. The remainder is 0.\nFor every spot from 0 to the last position of bits.\nSet remainder to (remainder times 2 plus item spot of bits) modulo 5. If remainder is 0, Place \"true\" into answers, otherwise Place \"false\" into answers.\n\nThe line is join answers with \",\". Show line.\n","expected":"true,false,false\n","step_budget":2000000},{"id":1019,"slug":"next-greater-node-in-linked-list","title":"Next Greater Node In Linked List","difficulty":"Medium","category":"Array","code":"Keep a shared scores holding 2, 7, 4, 3, and 5. The answers is an empty list of whole numbers. Keep a shared following of 0.\n\nTo seek from start (a whole number) with value (a whole number). Set following to 0. The begin is start plus 1. The finish is the last position of scores.\nFor every probe from begin to finish.\nIf item probe of scores is more than value, set following to item probe of scores, stop.\n\nFor every spot from 0 to the last position of scores.\nThe value is item spot of scores. Seek from spot with value. Place following into answers.\n\nThe line is empty text.\nFor each answer in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number answer as text into line.\n\nShow line.\n","expected":"7,0,5,5,0\n","step_budget":2000000},{"id":1020,"slug":"number-of-enclaves","title":"Number of Enclaves","difficulty":"Medium","category":"Array","code":"The grid is a list of 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, and 0. The seen is a list of 16 zeros. The queue is an empty list of whole numbers. The count is 0.\nFor every cell from 0 to 15.\nThe rank is cell divided by 4. The column is cell modulo 4. The edge is 0. If rank is 0 or rank is 3 or column is 0 or column is 3, set edge to 1. If edge is 1 and item cell of grid is 1, set item cell of seen to 1, Place cell into queue, add 1 to count.\n\nThe head is 0.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The rank is node divided by 4. The column is node modulo 4. If rank is more than 0 and item (node minus 4) of grid is 1 and item (node minus 4) of seen is 0, set item (node minus 4) of seen to 1, Place (node minus 4) into queue, add 1 to count. If rank is less than 3 and item (node plus 4) of grid is 1 and item (node plus 4) of seen is 0, set item (node plus 4) of seen to 1, Place (node plus 4) into queue, add 1 to count. If column is more than 0 and item (node minus 1) of grid is 1 and item (node minus 1) of seen is 0, set item (node minus 1) of seen to 1, Place (node minus 1) into queue, add 1 to count. If column is less than 3 and item (node plus 1) of grid is 1 and item (node plus 1) of seen is 0, set item (node plus 1) of seen to 1, Place (node plus 1) into queue, add 1 to count.\n\nThe total is 0.\nFor every cell from 0 to 15.\nIf item cell of grid is 1 and item cell of seen is 0, add 1 to total.\n\nShow total.\n","expected":"3\n","step_budget":2000000},{"id":1021,"slug":"remove-outermost-parentheses","title":"Remove Outermost Parentheses","difficulty":"Easy","category":"String","code":"Keep a shared source as empty text. Place \"(()())(())\" into source. The built is empty text. The depth is 0.\nFor every spot from 0 to the last position of source.\nThe symbol is the slice of source from spot to spot plus 1. The opening is 0. If symbol is \"(\", set opening to 1. If opening is 1 and depth is more than 0, Place symbol into built. If opening is 1, add 1 to depth. If opening is 0, subtract 1 from depth. If opening is 0 and depth is more than 0, Place symbol into built.\n\nShow built.\n","expected":"()()()\n","step_budget":2000000},{"id":1022,"slug":"sum-of-root-to-leaf-binary-numbers","title":"Sum of Root To Leaf Binary Numbers","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared values holding 1, 0, 1, 0, 1, 0, and 1. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1. Keep a shared total of 0.\n\nTo gather from node (a whole number) with path (a whole number). If node is less than 0, return. The carried is path times 2 plus item node of values. The left is item node of lefts. If left is less than 0 and item node of rights is less than 0, add carried to total, return. Gather from left with carried. Gather from item node of rights with carried.\n\nGather from 0 with 0. Show total.\n","expected":"22\n","step_budget":2000000},{"id":1023,"slug":"camelcase-matching","title":"Camelcase Matching","difficulty":"Medium","category":"Array","code":"Keep a shared current as empty text. Keep a shared raised as empty text. Keep a shared capitals as empty text. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into capitals. The pattern is \"FB\". The queries is a list of \"FooBar\", \"FooBarTest\", \"FootBall\", \"FrameBuffer\", and \"ForceFeedBack\". The flags is an empty list of whole numbers.\n\nTo raise. Set raised to empty text.\nFor every spot from 0 to the last position of current.\nThe symbol is the slice of current from spot to spot plus 1. If capitals contains symbol, Place symbol into raised.\n\nFor each query in queries.\nSet current to query. Raise. If raised is pattern, Place 1 into flags, otherwise Place 0 into flags.\n\nFor each flag in flags.\nIf flag is 1, show true, otherwise show false.\n","expected":"true\nfalse\ntrue\ntrue\nfalse\n","step_budget":2000000},{"id":1024,"slug":"video-stitching","title":"Video Stitching","difficulty":"Medium","category":"Array","code":"The starts is a list of 0, 4, 8, 1, 1, and 5. The ends is a list of 2, 6, 10, 9, 5, and 9. The time is 10. The table is a list of 11 zeros. Set item 0 of table to 0.\nFor every moment from 1 to 10.\nSet item moment of table to 1000000.\n\nFor every moment from 1 to 10.\nFor every clip from 0 to 5.\nThe start is item clip of starts. The finish is item clip of ends.\nIf start is less than moment and moment is at most finish.\nThe prior is item start of table. If prior plus 1 is less than item moment of table, set item moment of table to prior plus 1.\n\nShow item 10 of table.\n","expected":"3\n","step_budget":2000000},{"id":1025,"slug":"divisor-game","title":"Divisor Game","difficulty":"Easy","category":"Math","code":"The number is 3. The table is a list of 4 zeros. Set item 0 of table to 0.\nFor every amount from 1 to 3.\nFor every pick from 1 to amount minus 1.\nIf amount modulo pick is 0 and item (amount minus pick) of table is 0.\nSet item amount of table to 1.\n\nIf item 3 of table is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":1026,"slug":"maximum-difference-between-node-and-ancestor","title":"Maximum Difference Between Node and Ancestor","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 8, 3, 10, 1, 6, -1, 14, -1, -1, 4, 7, and 13. Keep a shared lefts holding 1, 3, 5, 7, 9, -1, 11, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, 8, 10, -1, -1, -1, -1, -1, -1, and -1. Keep a shared best of 0.\n\nTo search from node (a whole number) with low (a whole number) and high (a whole number). If node is less than 0, return. If item node of values is less than 0, return. The value is item node of values. The floor is low. The ceiling is high. If value is less than floor, set floor to value. If value is more than ceiling, set ceiling to value. The gap is ceiling minus floor. If gap is more than best, set best to gap. Search from item node of lefts with floor and ceiling. Search from item node of rights with floor and ceiling.\n\nSearch from 0 with 8 and 8. Show best.\n","expected":"7\n","step_budget":2000000},{"id":1027,"slug":"longest-arithmetic-subsequence","title":"Longest Arithmetic Subsequence","difficulty":"Medium","category":"Array","code":"The numbers is a list of 3, 6, 9, and 12. The size is 4. The table is a list of 16 zeros. The best is 2.\nFor every later from 1 to 3.\nFor every earlier from 0 to later minus 1.\nSet item (later times size plus earlier) of table to 2. The step is item later of numbers minus item earlier of numbers.\nFor every prior from 0 to earlier minus 1.\nThe oldstep is item earlier of numbers minus item prior of numbers.\nIf oldstep is step.\nThe candidate is item (earlier times size plus prior) of table plus 1. If candidate is more than item (later times size plus earlier) of table, set item (later times size plus earlier) of table to candidate. If candidate is more than best, set best to candidate.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":1028,"slug":"recover-a-tree-from-preorder-traversal","title":"Recover a Tree From Preorder Traversal","difficulty":"Hard","category":"String","code":"Keep a shared traversal as empty text. Place \"1-2--3--4-5--6--7\" into traversal. Keep a shared values as an empty list of whole numbers. Keep a shared depths as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared stack as an empty list of whole numbers. The number is 0. The depth is 0. The inside is 0. The gaps is 0.\n\nFor every spot from 0 to the last position of traversal.\nThe symbol is the slice of traversal from spot to spot plus 1. The dash is 0. If symbol is \"-\", set dash to 1. If dash is 1 and inside is 1, Place number into values, Place depth into depths, set number to 0, set inside to 0, set depth to 0. If dash is 1, add 1 to depth. If dash is 0, The digit is the digit value of character spot of traversal, set number to number times 10 plus digit, set inside to 1.\n\nIf inside is 1, Place number into values, Place depth into depths.\nFor every spot from 0 to the last position of values.\nPlace -1 into lefts. Place -1 into rights.\n\nTo trim with level (a whole number). The settled is 0.\nRepeat while settled is 0.\nThe end is the last position of stack. If end is less than 0, set settled to 1, stop. If item (item end of stack) of depths is less than level, set settled to 1, stop. Remove the last item from stack.\n\nPlace 0 into stack.\nFor every node from 1 to the last position of values.\nTrim with item node of depths. The end is the last position of stack. The parent is item end of stack. If item parent of lefts is less than 0, set item parent of lefts to node, otherwise set item parent of rights to node. Place node into stack.\n\nThe queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Show item node of values. The left is item node of lefts. The right is item node of rights. If left is at least 0, Place left into queue, add 1 to count. If right is at least 0, Place right into queue, add 1 to count.\n","expected":"1\n2\n5\n3\n4\n6\n7\n","step_budget":2000000},{"id":1029,"slug":"two-city-scheduling","title":"Two City Scheduling","difficulty":"Medium","category":"Array","code":"The firsts is a list of 10, 30, 400, and 30. The seconds is a list of 20, 200, 50, and 20. The size is 4. The wanted is 2. The order is an empty list of whole numbers. The gaps is an empty list of whole numbers.\nFor every city from 0 to 3.\nPlace city into order. Place item city of firsts minus item city of seconds into gaps.\n\nFor every spot from 0 to 3.\nFor every look from spot plus 1 to 3.\nThe here is item spot of order. The there is item look of order. If item there of gaps is less than item here of gaps, swap item spot of order and item look of order.\n\nThe total is 0.\nFor every city from 0 to 3.\nThe picked is item city of order. If city is less than wanted, set total to total plus item picked of firsts. If city is at least wanted, set total to total plus item picked of seconds.\n\nShow total.\n","expected":"110\n","step_budget":2000000},{"id":1030,"slug":"matrix-cells-in-distance-order","title":"Matrix Cells in Distance Order","difficulty":"Easy","category":"Array","code":"The rows is 2, while the columns is 2. The centerrow is 0, while the centercolumn is 1. The keys is an empty list of whole numbers.\nFor every cell from 0 to 3.\nThe across is cell divided by columns. The down is cell modulo columns. The steps is the absolute value of (across minus centerrow). The side is the absolute value of (down minus centercolumn). The key is (steps plus side) times 100 plus cell. Place key into keys.\n\nFor every spot from 0 to 3.\nFor every look from spot plus 1 to 3.\nIf item look of keys is less than item spot of keys, swap item spot of keys and item look of keys.\n\nFor each key in keys.\nThe cell is key modulo 100. The across is cell divided by columns. The down is cell modulo columns. The line is empty text. Place format whole number across as text into line. Place \",\" into line. The side is format whole number down as text. Place side into line. Show line.\n","expected":"0,1\n0,0\n1,1\n1,0\n","step_budget":2000000},{"id":1031,"slug":"maximum-sum-of-two-non-overlapping-subarrays","title":"Maximum Sum of Two Non-Overlapping Subarrays","difficulty":"Medium","category":"Array","code":"The numbers is a list of 0, 6, 5, 2, 2, 5, 1, 9, and 4. The size is 9. The firstlen is 1, while the secondlen is 2. The prefix is a list of 10 zeros.\nFor every spot from 0 to 8.\nSet item (spot plus 1) of prefix to item spot of prefix plus item spot of numbers.\n\nThe best is 0.\nFor every first from 0 to size minus firstlen.\nFor every second from 0 to size minus secondlen.\nThe firstsum is item (first plus firstlen) of prefix minus item first of prefix. The secondsum is item (second plus secondlen) of prefix minus item second of prefix. The apart is 0. If first plus firstlen is at most second, set apart to 1. If second plus secondlen is at most first, set apart to 1. If apart is 1 and firstsum plus secondsum is more than best, set best to firstsum plus secondsum.\n\nShow best.\n","expected":"20\n","step_budget":2000000},{"id":1033,"slug":"moving-stones-until-consecutive","title":"Moving Stones Until Consecutive","difficulty":"Medium","category":"Math","code":"The stones is a list of 1, 2, and 5. Sort stones. The smallest is item 0 of stones. The middle is item 1 of stones. The largest is item 2 of stones. The firstgap is middle minus smallest. The secondgap is largest minus middle. The fewest is 2. If firstgap is 1 and secondgap is 1, set fewest to 0. If firstgap is 2 or secondgap is 2, set fewest to 1. If firstgap is 1 and secondgap is more than 1, set fewest to 1. The most is largest minus smallest minus 2. Show fewest. Show most.\n","expected":"1\n2\n","step_budget":2000000},{"id":1034,"slug":"coloring-a-border","title":"Coloring A Border","difficulty":"Medium","category":"Array","code":"Keep a shared grid holding 1, 1, 1, and 2. Keep a shared visited as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared border as an empty list of whole numbers. Keep a shared rows of 0. Keep a shared columns of 0. Keep a shared old of 0. Keep a shared color of 0. Keep a shared count of 0. Set rows to 2. Set columns to 2. Set old to 1. Set color to 3.\nFor every cell from 0 to 3.\nPlace 0 into visited.\n\nTo include with node (a whole number).\nIf item node of visited is 0 and item node of grid is old.\nSet item node of visited to 1. Place node into queue. Add 1 to count.\n\nTo mark with node (a whole number). The across is node divided by columns. The down is node modulo columns. The edge is 0. If across is 0 or across is rows minus 1 or down is 0 or down is columns minus 1, set edge to 1. If across is more than 0 and item (node minus columns) of grid is not old, set edge to 1. If across is less than rows minus 1 and item (node plus columns) of grid is not old, set edge to 1. If down is more than 0 and item (node minus 1) of grid is not old, set edge to 1. If down is less than columns minus 1 and item (node plus 1) of grid is not old, set edge to 1. If edge is 1, Place node into border.\n\nThe head is 0. Include with 0.\nRepeat while head is less than count.\nThe spot is head. The node is item spot of queue. Add 1 to head. Mark with node. The across is node divided by columns. The down is node modulo columns. If across is more than 0, Include with node minus columns. If across is less than rows minus 1, Include with node plus columns. If down is more than 0, Include with node minus 1. If down is less than columns minus 1, Include with node plus 1.\n\nFor each node in border.\nSet item node of grid to color.\n\nFor each value in grid.\nShow value.\n","expected":"3\n3\n3\n2\n","step_budget":2000000},{"id":1035,"slug":"uncrossed-lines","title":"Uncrossed Lines","difficulty":"Medium","category":"Array","code":"The first is a list of 1, 4, and 2. The second is a list of 1, 2, and 4. The width is 3. The table is a list of 16 zeros.\nFor every left from 1 to 3.\nFor every right from 1 to 3.\nThe cell is left times 4 plus right. The above is left minus 1. The side is right minus 1. The here is item above of first. The there is item side of second. If here is there, The old is item (above times 4 plus side) of table, set item cell of table to old plus 1. The north is item (above times 4 plus right) of table. The west is item (left times 4 plus side) of table. The best is the larger of north and west. If here is not there, set item cell of table to best.\n\nShow item 15 of table.\n","expected":"2\n","step_budget":2000000},{"id":1036,"slug":"escape-a-large-maze","title":"Escape a Large Maze","difficulty":"Hard","category":"Array","code":"Keep a shared blocked holding 1 and 1000000. Keep a shared visited as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. The source is 0. The target is 2. The count is 0. The head is 0.\n\nTo open with code (a whole number). The across is code divided by 1000000. The down is code modulo 1000000. If across is less than 0 or across is more than 999999, return. If down is less than 0 or down is more than 999999, return. If blocked contains code, return. If visited contains code, return. Place code into visited. Place code into queue. Add 1 to count.\n\nOpen with source.\nRepeat while head is less than count and count is at most 20000.\nThe node is item head of queue. Add 1 to head. The across is node divided by 1000000. The down is node modulo 1000000. If across is more than 0, Open with node minus 1000000. If across is less than 999999, Open with node plus 1000000. If down is more than 0, Open with node minus 1. If down is less than 999999, Open with node plus 1.\n\nThe escaped is 0. If visited contains target, set escaped to 1. If count is more than 20000, set escaped to 1. If escaped is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":1037,"slug":"valid-boomerang","title":"Valid Boomerang","difficulty":"Easy","category":"Array","code":"The firstx is 1, while the firsty is 1. The secondx is 2, while the secondy is 3. The thirdx is 3, while the thirdy is 2. The left is (secondx minus firstx) times (thirdy minus firsty). The right is (secondy minus firsty) times (thirdx minus firstx). If left is right, show false, otherwise show true.\n","expected":"true\n","step_budget":2000000},{"id":1038,"slug":"binary-search-tree-to-greater-sum-tree","title":"Binary Search Tree to Greater Sum Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 4, 1, 6, 0, 2, 5, and 7. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1. Keep a shared running of 0.\n\nTo revise from node (a whole number). If node is less than 0, return. Revise from item node of rights. Increase running by item node of values. Set item node of values to running. Revise from item node of lefts.\n\nRevise from 0. The queue is an empty list of whole numbers. Place 0 into queue. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. Show item node of values. The left is item node of lefts. The right is item node of rights. If left is at least 0, Place left into queue, add 1 to count. If right is at least 0, Place right into queue, add 1 to count.\n","expected":"22\n25\n13\n25\n24\n18\n7\n","step_budget":2000000},{"id":1039,"slug":"minimum-score-triangulation-of-polygon","title":"Minimum Score Triangulation of Polygon","difficulty":"Medium","category":"Array","code":"The values is a list of 3, 7, 4, and 5. The size is 4. The table is a list of 16 zeros.\nFor every gap from 2 to 3.\nFor every start from 0 to size minus 1 minus gap.\nThe finish is start plus gap. The cell is start times size plus finish. Set item cell of table to 1000000.\nFor every split from start plus 1 to finish minus 1.\nThe leftcell is start times size plus split. The rightcell is split times size plus finish. The candidate is item leftcell of table plus item rightcell of table plus item start of values times item split of values times item finish of values. If candidate is less than item cell of table, set item cell of table to candidate.\n\nShow item 3 of table.\n","expected":"144\n","step_budget":2000000},{"id":1040,"slug":"moving-stones-until-consecutive-ii","title":"Moving Stones Until Consecutive II","difficulty":"Medium","category":"Array","code":"The stones is a list of 7, 4, and 9. Sort stones. The size is 3. The largest is item 2 of stones minus item 1 of stones. The smallest is item 1 of stones minus item 0 of stones. The span is the larger of largest and smallest. The most is span minus 1. The fewest is 3.\nFor every start from 0 to 2.\nThe finish is start. The count is 1. If size minus count is less than fewest, set fewest to size minus count.\nRepeat while finish plus 1 is less than size and item (finish plus 1) of stones minus item start of stones plus 1 is at most size.\nAdd 1 to finish. Add 1 to count. If count is size, set fewest to 0. If count is size minus 1 and item finish of stones minus item start of stones plus 1 is size, set fewest to 1. If count is less than size minus 1 and size minus count is less than fewest, set fewest to size minus count.\n\nShow fewest. Show most.\n","expected":"1\n2\n","step_budget":2000000},{"id":1041,"slug":"robot-bounded-in-circle","title":"Robot Bounded In Circle","difficulty":"Medium","category":"String","code":"Keep a shared instructions as empty text. Place \"GGLLGG\" into instructions. Keep a shared across of 0. Keep a shared down of 0. Keep a shared facing of 0. Keep a shared east holding 0, 1, 0, and -1. Keep a shared north holding 1, 0, -1, and 0.\n\nTo travel.\nFor every spot from 0 to the last position of instructions.\nThe symbol is the slice of instructions from spot to spot plus 1. The move is 0. If symbol is \"G\", set move to 1. If symbol is \"L\", subtract 1 from facing, set facing to facing modulo 4. If symbol is \"R\", add 1 to facing, set facing to facing modulo 4. If facing is less than 0, set facing to facing plus 4. The side is facing. If move is 1, set across to across plus item side of east, set down to down plus item side of north.\n\nTravel. The bounded is 1. If across is 0 and down is 0, set bounded to 1. If across is not 0 or down is not 0, set bounded to 0. If facing is not 0, set bounded to 1. If bounded is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1042,"slug":"flower-planting-with-no-adjacent","title":"Flower Planting With No Adjacent","difficulty":"Medium","category":"Depth-First Search","code":"The firsts is a list of 0 and 2. The seconds is a list of 1 and 3. The count is 4. The colors is a list of 0, 0, 0, and 0.\nFor every garden from 0 to count minus 1.\nThe used is an empty list of whole numbers.\nFor every edge from 0 to the last position of firsts.\nThe other is -1. If item edge of firsts is garden, set other to item edge of seconds. If item edge of seconds is garden, set other to item edge of firsts. If other is at least 0, The shade is item other of colors, Place shade into used.\nFor every choice from 1 to 4.\nIf used does not contain choice, set item garden of colors to choice, stop.\n\nFor each value in colors, Show value.\n","expected":"1\n2\n1\n2\n","step_budget":2000000},{"id":1043,"slug":"partition-array-for-maximum-sum","title":"Partition Array for Maximum Sum","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 15, 7, 9, 2, 5, and 10. The span is 3. The count is 7. The best is a list of 8 zeros.\nFor every finish from 1 to count.\nThe largest is 0.\nFor every width from 1 to span.\nIf width is at most finish.\nThe start is finish minus width. The here is item start of numbers. If here is more than largest, set largest to here. The candidate is item start of best plus width times largest. If candidate is more than item finish of best, set item finish of best to candidate.\n\nShow item count of best.\n","expected":"84\n","step_budget":2000000},{"id":1044,"slug":"longest-duplicate-substring","title":"Longest Duplicate Substring","difficulty":"Hard","category":"String","code":"The source is \"banana\". The last is the last position of source. The found is 0. The answer is empty text.\nFor every step from 1 to last.\nThe span is last plus 1 minus step.\nFor every first from 0 to last plus 1 minus span.\nFor every second from first plus 1 to last plus 1 minus span.\nThe leftpiece is the slice of source from first to first plus span. The rightpiece is the slice of source from second to second plus span. If leftpiece matches rightpiece, set answer to leftpiece, set found to 1, stop. If found is 1, stop. If found is 1, stop.\n\nShow answer.\n","expected":"ana\n","step_budget":2000000},{"id":1046,"slug":"last-stone-weight","title":"Last Stone Weight","difficulty":"Easy","category":"Array","code":"The stones is a list of 2, 7, 4, 1, 8, and 1.\nRepeat while the number of items in stones is more than 1.\nSort stones. The heavy is the last item of stones. Remove the last item from stones. The light is the last item of stones. Remove the last item from stones. If heavy is not light, The rest is heavy minus light, Place rest into stones.\n\nShow item 0 of stones.\n","expected":"1\n","step_budget":2000000},{"id":1047,"slug":"remove-all-adjacent-duplicates-in-string","title":"Remove All Adjacent Duplicates In String","difficulty":"Easy","category":"String","code":"The source is \"abbaca\". The kept is empty text. The held is 0.\nFor every spot from 0 to the last position of source.\nThe symbol is character spot of source. The top is 0. If held is more than 0, set top to character (held minus 1) of kept. The removed is 0. If held is more than 0 and top is symbol, remove last character from kept, subtract 1 from held, set removed to 1. If removed is 0, Place symbol into kept, add 1 to held.\n\nShow kept.\n","expected":"ca\n","step_budget":2000000},{"id":1048,"slug":"longest-string-chain","title":"Longest String Chain","difficulty":"Medium","category":"Array","code":"The words is a list of \"a\", \"b\", \"ba\", \"bca\", \"bda\", and \"bdca\". The count is 6. The last is count minus 1.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nThe first is item left of words. The second is item right of words. The firstsize is the number of characters in first. The secondsize is the number of characters in second. If secondsize is less than firstsize, swap item left of words and item right of words.\n\nThe best is a list of 6 zeros.\nFor every spot from 0 to last.\nSet item spot of best to 1.\n\nFor every right from 0 to last.\nFor every left from 0 to right minus 1.\nThe shortraw is item left of words. The longraw is item right of words. The short is empty text. Place shortraw into short. The long is empty text. Place longraw into long. The shortsize is the number of characters in short. The longsize is the number of characters in long. The longlast is the last position of long. The paired is 0.\nFor every cut from 0 to longlast.\nThe leftpart is the slice of long from 0 to cut. The rightpart is the slice of long from cut plus 1 to longlast plus 1. The joined is a copy of leftpart. Place rightpart into joined. If joined matches short, set paired to 1. If paired is 1 and item left of best plus 1 is more than item right of best, set item right of best to item left of best plus 1. If paired is 1, stop.\n\nThe answer is 0.\nFor each value in best.\nIf value is more than answer, set answer to value.\n\nShow answer.\n","expected":"4\n","step_budget":2000000},{"id":1049,"slug":"last-stone-weight-ii","title":"Last Stone Weight II","difficulty":"Medium","category":"Array","code":"The stones is a list of 2, 7, 4, 1, 8, and 1. The total is 0.\nFor each stone in stones.\nAdd stone to total.\n\nThe goal is total divided by 2. The possible is a list of 12 zeros. Set item 0 of possible to 1.\nFor each stone in stones.\nFor every step from 0 to goal.\nThe sum is goal minus step. If item sum of possible is 1 and sum plus stone is at most goal, set item (sum plus stone) of possible to 1.\n\nThe best is 0.\nFor every sum from 0 to goal.\nIf item sum of possible is 1, set best to sum.\n\nThe answer is total minus 2 times best. Show answer.\n","expected":"1\n","step_budget":2000000},{"id":1051,"slug":"height-checker","title":"Height Checker","difficulty":"Easy","category":"Array","code":"The heights is a list of 1, 1, 4, 2, 1, and 3. The ordered is an empty list of whole numbers.\nFor each height in heights.\nPlace height into ordered.\n\nSort ordered. The total is 0.\nFor every spot from 0 to the last position of heights.\nIf item spot of heights is not item spot of ordered, add 1 to total.\n\nShow total.\n","expected":"3\n","step_budget":2000000},{"id":1052,"slug":"grumpy-bookstore-owner","title":"Grumpy Bookstore Owner","difficulty":"Medium","category":"Array","code":"The customers is a list of 1, 0, 1, 2, 1, 1, 7, and 5. The moods is a list of 0, 1, 0, 1, 0, 1, 0, and 1. The minutes is 3. The last is 7. The base is 0.\nFor every spot from 0 to last.\nThe amount is item spot of customers. If item spot of moods is 0, add amount to base.\n\nThe best is 0.\nFor every start from 0 to last minus minutes plus 1.\nThe extra is 0.\nFor every step from 0 to minutes minus 1.\nThe spot is start plus step. The amount is item spot of customers. If item spot of moods is 1, add amount to extra. If extra is more than best, set best to extra.\n\nThe answer is base plus best. Show answer.\n","expected":"16\n","step_budget":2000000},{"id":1053,"slug":"previous-permutation-with-one-swap","title":"Previous Permutation With One Swap","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 1, 9, 4, 6, and 7. Keep a shared pivot of -1. Keep a shared bestspot of 0. Keep a shared bestvalue of 0.\n\nTo choose.\nFor every spot from pivot plus 1 to the last position of numbers.\nThe value is item spot of numbers. The place is pivot. The cap is item place of numbers. If value is less than cap and value is at least bestvalue, set bestvalue to value, set bestspot to spot.\n\nThe last is the last position of numbers.\nFor every step from 0 to last minus 1.\nThe spot is last minus 1 minus step. If item spot of numbers is more than item (spot plus 1) of numbers, set pivot to spot, stop.\n\nSet bestspot to pivot plus 1. The target is bestspot. If pivot is at least 0, set bestvalue to item target of numbers. If pivot is at least 0, Choose. The place is pivot. The other is bestspot. If pivot is at least 0, swap item place of numbers and item other of numbers. For each value in numbers, Show value.\n","expected":"1\n7\n4\n6\n9\n","step_budget":2000000},{"id":1054,"slug":"distant-barcodes","title":"Distant Barcodes","difficulty":"Medium","category":"Array","code":"Keep a shared labels as an empty list of whole numbers. Keep a shared counts as an empty list of whole numbers. Keep a shared wanted of 0. Keep a shared located of 0. Keep a shared best of 0. Keep a shared bestcount of 0. Keep a shared previous of -1.\n\nTo locate from spot (a whole number). If spot is more than the last position of labels, return. If item spot of labels is wanted, set located to spot, return. Locate from spot plus 1.\n\nThe barcodes is a list of 1, 1, 1, 2, 2, and 3.\nFor each code in barcodes.\nSet wanted to code. Set located to -1. Locate from 0. The place is located. If place is at least 0, set item place of counts to item place of counts plus 1. If place is less than 0, Place code into labels, Place 1 into counts.\n\nTo pick. Set best to 0. Set bestcount to -1.\nFor every spot from 0 to the last position of labels.\nThe label is item spot of labels. The amount is item spot of counts. If label is not previous and amount is more than bestcount, set best to spot, set bestcount to amount.\n\nThe result is an empty list of whole numbers.\nFor every position from 0 to the last position of barcodes.\nPick. The spot is best. The chosen is item spot of labels. Place chosen into result. The place is best. Decrease item place of counts by 1. Set previous to chosen.\n\nFor each code in result, Show code.\n","expected":"1\n2\n1\n2\n1\n3\n","step_budget":2000000},{"id":1061,"slug":"lexicographically-smallest-equivalent-string","title":"Lexicographically Smallest Equivalent String","difficulty":"Medium","category":"String","code":"Keep a shared alphabet as empty text. Keep a shared targetcode of 0. Keep a shared rankresult of 0. Keep a shared parents as an empty list of whole numbers. Keep a shared rootletter of 0.\n\nTo rank.\nFor every probe from 0 to 25.\nIf character probe of alphabet is targetcode, set rankresult to probe, return.\n\nTo seek from letter (a whole number). If item letter of parents is letter, set rootletter to letter, return. Seek from item letter of parents.\n\nThe letters is \"abcdefghijklmnopqrstuvwxyz\". The frozen is a copy of letters. Set alphabet to frozen.\nFor every spot from 0 to 25.\nPlace spot into parents.\n\nThe first is \"parker\". The second is \"morris\". The base is \"parser\".\nFor every spot from 0 to the last position of first.\nSet targetcode to character spot of first. Rank. The left is rankresult. Set targetcode to character spot of second. Rank. The right is rankresult. Seek from left. The firstroot is rootletter. Seek from right. The secondroot is rootletter. If firstroot is less than secondroot, set item secondroot of parents to firstroot. If secondroot is less than firstroot, set item firstroot of parents to secondroot.\n\nThe answer is empty text.\nFor every spot from 0 to the last position of base.\nSet targetcode to character spot of base. Rank. Seek from rankresult. The place is rootletter. The mapped is character place of alphabet. Place mapped into answer.\n\nShow answer.\n","expected":"makkek\n","step_budget":2000000},{"id":1071,"slug":"greatest-common-divisor-of-strings","title":"Greatest Common Divisor of Strings","difficulty":"Easy","category":"String","code":"Keep a shared leftsize of 0. Keep a shared rightsize of 0.\n\nTo reduce.\nRepeat while rightsize is more than 0.\nThe rest is leftsize modulo rightsize. Set leftsize to rightsize. Set rightsize to rest.\n\nThe first is \"ABCABC\". The second is \"ABC\". The joined is a copy of first. Place second into joined. The other is a copy of second. Place first into other. The firstlast is the last position of first. The secondlast is the last position of second. Set leftsize to firstlast plus 1. Set rightsize to secondlast plus 1. Reduce. The span is leftsize. The piece is the slice of first from 0 to span. The answer is a copy of piece. The empty is empty text. The same is 0. If joined matches other, set same to 1. If same is 0, set answer to empty. Show answer.\n","expected":"ABC\n","step_budget":2000000},{"id":1072,"slug":"flip-columns-for-maximum-number-of-equal-rows","title":"Flip Columns For Maximum Number of Equal Rows","difficulty":"Medium","category":"Array","code":"The grid is a list of 0, 1, 1, and 0. The rows is 2. The columns is 2. The keys is an empty list of whole numbers.\nFor every row from 0 to rows minus 1.\nThe anchor is item (row times columns) of grid. The key is 0.\nFor every column from 0 to columns minus 1.\nThe cell is item (row times columns plus column) of grid. The bit is exclusive or of cell and anchor. Set key to key times 3 plus bit. Place key into keys.\n\nThe best is 0.\nFor each key in keys.\nThe count is 0.\nFor each other in keys.\nIf other is key, add 1 to count. If count is more than best, set best to count.\n\nShow best.\n","expected":"2\n","step_budget":2000000},{"id":1073,"slug":"adding-two-negabinary-numbers","title":"Adding Two Negabinary Numbers","difficulty":"Medium","category":"Array","code":"The first is a list of 1, 1, 1, 1, and 1. The second is a list of 1, 0, and 1. The firstspot is the last position of first. The secondspot is the last position of second. The carry is 0. The digits is an empty list of whole numbers.\nRepeat while firstspot is at least 0 or secondspot is at least 0 or carry is not 0.\nThe firstbit is 0. If firstspot is at least 0, set firstbit to item firstspot of first. The secondbit is 0. If secondspot is at least 0, set secondbit to item secondspot of second. The total is carry plus firstbit plus secondbit. If firstspot is at least 0, subtract 1 from firstspot. If secondspot is at least 0, subtract 1 from secondspot. The bit is total modulo 2. If bit is less than 0, add 2 to bit. Place bit into digits. Set carry to (total minus bit) divided by (0 minus 2).\n\nThe last is the last position of digits.\nRepeat while last is more than 0 and item last of digits is 0.\nRemove the last item from digits. Set last to the last position of digits.\n\nFor every step from 0 to last.\nThe place is last minus step. Show item place of digits.\n","expected":"1\n0\n0\n0\n0\n","step_budget":2000000},{"id":1074,"slug":"number-of-submatrices-that-sum-to-target","title":"Number of Submatrices That Sum to Target","difficulty":"Hard","category":"Array","code":"The grid is a list of 0, 1, 0, 1, 1, 1, 0, 1, and 0. The rows is 3. The columns is 3. The width is 4. The target is 0. The prefix is a list of 16 zeros.\nFor every row from 0 to rows minus 1.\nFor every column from 0 to columns minus 1.\nThe index is (row plus 1) times width plus column plus 1. The above is index minus width. The before is index minus 1. The corner is index minus width minus 1. The cell is item (row times columns plus column) of grid. Set item index of prefix to item above of prefix plus item before of prefix minus item corner of prefix plus cell.\n\nThe total is 0.\nFor every top from 0 to rows minus 1.\nFor every bottom from top to rows minus 1.\nFor every left from 0 to columns minus 1.\nFor every right from left to columns minus 1.\nThe bottomright is (bottom plus 1) times width plus right plus 1. The topright is top times width plus right plus 1. The bottomleft is (bottom plus 1) times width plus left. The topleft is top times width plus left. The measured is item bottomright of prefix minus item topright of prefix minus item bottomleft of prefix plus item topleft of prefix. If measured is target, add 1 to total.\n\nShow total.\n","expected":"4\n","step_budget":2000000},{"id":1078,"slug":"occurrences-after-bigram","title":"Occurrences After Bigram","difficulty":"Easy","category":"String","code":"The sentence is \"alice is a good girl she is a good student\". The firstraw is \"a\". The secondraw is \"good\". The first is empty text. Place firstraw into first. The second is empty text. Place secondraw into second. The parts is split sentence by \" \". The answers is an empty list of text. The last is the last position of parts.\nFor every spot from 0 to last minus 2.\nThe leftraw is item spot of parts. The middleraw is item (spot plus 1) of parts. The rightraw is item (spot plus 2) of parts. The leftword is empty text. Place leftraw into leftword. The middleword is empty text. Place middleraw into middleword. The rightword is empty text. Place rightraw into rightword. The leftsame is 0. If leftword matches first, set leftsame to 1. The middlesame is 0. If middleword matches second, set middlesame to 1. If leftsame is 1 and middlesame is 1, Place rightword into answers.\n\nFor each word in answers, Show word.\n","expected":"girl\nstudent\n","step_budget":2000000},{"id":1079,"slug":"letter-tile-possibilities","title":"Letter Tile Possibilities","difficulty":"Medium","category":"String","code":"Keep a shared source as empty text. Keep a shared letters as empty text. Keep a shared targetcode of 0. Keep a shared rankresult of 0. Keep a shared used as an empty list of whole numbers. Keep a shared codes as an empty list of whole numbers. Keep a shared total of 0.\n\nTo rank.\nFor every probe from 0 to 25.\nIf character probe of letters is targetcode, set rankresult to probe, return.\n\nTo climb from code (a whole number).\nFor every spot from 0 to the last position of source.\nIf item spot of used is 0, Step from spot with code.\n\nTo step from spot (a whole number) with code (a whole number). Set item spot of used to 1. Set targetcode to character spot of source. Rank. The next is code times 27 plus rankresult plus 1. If codes does not contain next, Place next into codes, add 1 to total. Climb from next. Set item spot of used to 0.\n\nThe given is \"AAB\". Set source to a copy of given. The alphabet is \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\". The frozen is a copy of alphabet. Set letters to frozen.\nFor every spot from 0 to the last position of source.\nPlace 0 into used.\n\nClimb from 0. Show total.\n","expected":"8\n","step_budget":2000000},{"id":1080,"slug":"insufficient-nodes-in-root-to-leaf-paths","title":"Insufficient Nodes in Root to Leaf Paths","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared gone as an empty list of whole numbers. Keep a shared cap of 0. Keep a shared result of 0. Set cap to 22. Place 5 into values. Place 4 into values. Place 8 into values. Place 11 into values. Place 0 into values. Place 17 into values. Place 4 into values. Place 7 into values. Place 1 into values. Place 0 into values. Place 0 into values. Place 5 into values. Place 3 into values. Place 1 into lefts. Place 3 into lefts. Place 5 into lefts. Place 7 into lefts. Place -1 into lefts. Place -1 into lefts. Place 11 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place 2 into rights. Place -1 into rights. Place 6 into rights. Place 8 into rights. Place -1 into rights. Place -1 into rights. Place 12 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights.\nFor every spot from 0 to 12.\nPlace 0 into gone.\n\nTo prune from node (a whole number) with total (a whole number). If node is less than 0, set result to -1000000000, return. The value is item node of values. The here is total plus value. The left is item node of lefts. The right is item node of rights. The leftbest is 0. The rightbest is 0. If left is at least 0, Prune from left with here, set leftbest to result. If right is at least 0, Prune from right with here, set rightbest to result. The best is -1000000000. If left is less than 0 and right is less than 0, set best to here. If left is at least 0 and leftbest is more than best, set best to leftbest. If right is at least 0 and rightbest is more than best, set best to rightbest. If best is less than cap, set item node of gone to 1. If best is at least cap, set item node of gone to 0. If left is at least 0 and item left of gone is 1, set item node of lefts to -1. If right is at least 0 and item right of gone is 1, set item node of rights to -1. Set result to best.\n\nPrune from 0 with 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.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The piece is empty text. If node is at least 0, set piece to format whole number item node of values as text. If node is at least 0, Place piece into pieces. If node is less than 0, Place \"null\" into pieces. If node is at least 0 and item node of gone is 0, Place item node of lefts into queue, Place item node of rights into queue, add 2 to count.\n\nRepeat while the last position of pieces is at least 0.\nThe tail is the last position of pieces. The tailpiece is item tail of pieces. The isnull is 0. If tailpiece matches \"null\", set isnull to 1. If isnull is 1, remove the last item from pieces. If isnull is 0, stop.\n\nThe line is join pieces with \",\". Show line.\n","expected":"5,4,8,11,null,17,4,7,null,null,null,5\n","step_budget":2000000},{"id":1081,"slug":"smallest-subsequence-of-distinct-characters","title":"Smallest Subsequence of Distinct Characters","difficulty":"Medium","category":"String","code":"Keep a shared alphabet as empty text. Keep a shared targetcode of 0. Keep a shared rankresult of 0. Keep a shared remaining as an empty list of whole numbers. Keep a shared used as an empty list of whole numbers. Keep a shared stack as an empty list of whole numbers.\n\nTo rank.\nFor every probe from 0 to 25.\nIf character probe of alphabet is targetcode, set rankresult to probe, return.\n\nTo trim from code (a whole number). The stacklast is the last position of stack. The topcode is 0. If stacklast is at least 0, set topcode to item stacklast of stack.\nRepeat while topcode is more than code and item topcode of remaining is more than 0.\nRemove the last item from stack. Set item topcode of used to 0. Set stacklast to the last position of stack. Set topcode to 0. If stacklast is at least 0, set topcode to item stacklast of stack.\n\nThe source is \"cbacdcbc\". The letters is \"abcdefghijklmnopqrstuvwxyz\". The frozen is a copy of letters. Set alphabet to frozen.\nFor every spot from 0 to 25.\nPlace 0 into remaining. Place 0 into used.\n\nFor every spot from 0 to the last position of source.\nSet targetcode to character spot of source. Rank. The code is rankresult. Increase item code of remaining by 1.\n\nFor every spot from 0 to the last position of source.\nSet targetcode to character spot of source. Rank. The code is rankresult. Decrease item code of remaining by 1. The fresh is 1. If item code of used is 1, set fresh to 0. If fresh is 1, Trim from code. If fresh is 1, Place code into stack, set item code of used to 1.\n\nThe answer is empty text.\nFor each code in stack.\nThe letter is character code of alphabet. Place letter into answer.\n\nShow answer.\n","expected":"acdb\n","step_budget":2000000},{"id":1089,"slug":"duplicate-zeros","title":"Duplicate Zeros","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 0, 2, 3, 0, 4, 5, and 0. The last is the last position of numbers. The size is last plus 1. The answers is a list of 8 zeros. The written is 0.\nFor every spot from 0 to size minus 1.\nThe value is item spot of numbers. If written is less than size, set item written of answers to value, add 1 to written. If value is 0 and written is less than size, set item written of answers to 0, add 1 to written.\n\nFor each value in answers, show value.\n","expected":"1\n0\n0\n2\n3\n0\n0\n4\n","step_budget":2000000},{"id":1090,"slug":"largest-values-from-labels","title":"Largest Values From Labels","difficulty":"Medium","category":"Array","code":"The values is a list of 5, 4, 3, 2, and 1. The labels is a list of 1, 1, 2, 2, and 3. The wanted is 3. The limit is 1. The ranked is an empty list of whole numbers. The tags is an empty list of whole numbers.\nFor every spot from 0 to the last position of values.\nThe value is item spot of values. The tag is item spot of labels. Place value into ranked. Place tag into tags. The place is the last position of ranked.\nRepeat while place is more than 0 and item (place minus 1) of ranked is less than value.\nSet item place of ranked to item (place minus 1) of ranked. Set item place of tags to item (place minus 1) of tags. Subtract 1 from place. Set item place of ranked to value. Set item place of tags to tag.\n\nThe used is a list of 4 zeros. The total is 0. The taken is 0.\nFor every spot from 0 to the last position of ranked.\nIf taken is less than wanted.\nThe tag is item spot of tags.\nIf item tag of used is less than limit.\nIncrease item tag of used by 1. The value is item spot of ranked. Add value to total. Add 1 to taken.\n\nShow total.\n","expected":"9\n","step_budget":2000000},{"id":1091,"slug":"shortest-path-in-binary-matrix","title":"Shortest Path in Binary Matrix","difficulty":"Medium","category":"Array","code":"The board is a list of 0, 0, 0, 1, 1, 0, 1, 1, and 0. The side is 3. The downsteps is a list of -1, -1, -1, 0, 0, 1, 1, and 1. The sidesteps is a list of -1, 0, 1, -1, 1, -1, 0, and 1. The distances is a list of 9 zeros. The queue is a list of 81 zeros. The head is 0. The count is 0. The answer is -1.\nIf item 0 of board is 0.\nSet item 0 of distances to 1. Set item 0 of queue to 0. Set count to 1.\n\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The band is node divided by side. The column is node modulo side. The depth is item node of distances plus 1.\nFor every step from 0 to 7.\nThe nextband is band plus item step of downsteps. The nextcolumn is column plus item step of sidesteps.\nIf nextband is at least 0 and nextband is less than side and nextcolumn is at least 0 and nextcolumn is less than side.\nThe target is nextband times side plus nextcolumn.\nIf item target of board is 0 and item target of distances is 0.\nSet item target of distances to depth. Set item count of queue to target. Add 1 to count.\n\nIf item 8 of distances is more than 0, set answer to item 8 of distances. Show answer.\n","expected":"4\n","step_budget":2000000},{"id":1092,"slug":"shortest-common-supersequence","title":"Shortest Common Supersequence ","difficulty":"Hard","category":"String","code":"The first is \"abac\". The second is \"cab\". The awidth is the length of first. The bwidth is the length of second. The width is bwidth plus 1. The table is an empty list of whole numbers.\nFor every spot from 0 to (awidth plus 1) times width minus 1.\nPlace 0 into table.\n\nFor every band from 1 to awidth.\nFor every column from 1 to bwidth.\nThe above is item ((band minus 1) times width plus column) of table. The beside is item (band times width plus column minus 1) of table. The corner is item ((band minus 1) times width plus column minus 1) of table. The best is above. If beside is more than best, set best to beside. The aat is band minus 1. The bat is column minus 1. The firstsymbol is character aat of first. The secondsymbol is character bat of second. If firstsymbol is secondsymbol, set best to corner plus 1. Set item (band times width plus column) of table to best.\n\nThe parts is an empty list of text. The band is awidth. The column is bwidth.\nRepeat while band is more than 0 and column is more than 0.\nThe aat is band minus 1. The bat is column minus 1. The firstsymbol is character aat of first. The secondsymbol is character bat of second. The upper is item (aat times width plus column) of table. The lower is item (band times width plus bat) of table. If firstsymbol is secondsymbol, The piece is the slice of first from aat to band, Place piece into parts, Subtract 1 from band, Subtract 1 from column. If firstsymbol is not secondsymbol and upper is at least lower, The piece is the slice of first from aat to band, Place piece into parts, Subtract 1 from band. If firstsymbol is not secondsymbol and upper is less than lower, The piece is the slice of second from bat to column, Place piece into parts, Subtract 1 from column.\n\nRepeat while band is more than 0.\nThe aat is band minus 1. The piece is the slice of first from aat to band. Place piece into parts. Subtract 1 from band.\n\nRepeat while column is more than 0.\nThe bat is column minus 1. The piece is the slice of second from bat to column. Place piece into parts. Subtract 1 from column.\n\nThe answer is an empty list of text. The spot is the last position of parts.\nRepeat while spot is at least 0.\nPlace item spot of parts into answer. Subtract 1 from spot.\n\nThe line is join answer with \"\". Show line.\n","expected":"cabac\n","step_budget":2000000},{"id":1093,"slug":"statistics-from-a-large-sample","title":"Statistics from a Large Sample","difficulty":"Medium","category":"Array","code":"The counts is a list of 256 zeros. Set item 1 of counts to 1. Set item 2 of counts to 3. Set item 3 of counts to 4. The total is 0. The weighted is 0. The low is -1. The high is -1. The best is 0. The mode is 0.\nFor every value from 0 to 255.\nThe seen is item value of counts. If seen is more than 0 and low is less than 0, set low to value. If seen is more than 0, set high to value. Add seen to total. The contribution is seen times value. Add contribution to weighted. If seen is more than best, set best to seen, set mode to value.\n\nThe order is (total minus 1) divided by 2. The other is total divided by 2. The lower is 0. The upper is 0. The running is 0.\nFor every value from 0 to 255.\nThe seen is item value of counts. The before is running. Add seen to running. If order is at least before and order is less than running, set lower to value. If other is at least before and other is less than running, set upper to value.\n\nKeep a shared rendered as empty text.\nTo render from scaled (a whole number). The parts is an empty list of text. The whole is scaled divided by 100000. The rest is scaled modulo 100000. The head is format whole number whole as text. Place head into parts. Place \".\" into parts. The remaining is rest.\nFor every slot from 0 to 4.\nThe unit is remaining divided by 10000. The digit is format whole number unit as text. Place digit into parts. Set remaining to (remaining modulo 10000) times 10. Set rendered to join parts with \"\".\n\nThe answers is an empty list of text. The lowscale is low times 100000. Render from lowscale. Place rendered into answers. The highscale is high times 100000. Render from highscale. Place rendered into answers. The meanscale is (weighted times 100000 plus total divided by 2) divided by total. Render from meanscale. Place rendered into answers. The medianscale is (lower plus upper) times 50000. Render from medianscale. Place rendered into answers. The modescale is mode times 100000. Render from modescale. Place rendered into answers.\n\nThe report is join answers with \",\". Show report.\n","expected":"1.00000,3.00000,2.37500,2.50000,3.00000\n","step_budget":2000000},{"id":1094,"slug":"car-pooling","title":"Car Pooling","difficulty":"Medium","category":"Array","code":"The trips is a list of 2, 1, 5, 3, 3, and 7. The capacity is 4. The changes is a list of 1001 zeros.\nFor every trip from 0 to 1.\nThe base is trip times 3. The riders is item base of trips. The start is item (base plus 1) of trips. The finish is item (base plus 2) of trips. Increase item start of changes by riders. Decrease item finish of changes by riders.\n\nThe current is 0. The overloaded is 0.\nFor every place from 0 to 1000.\nThe change is item place of changes. Add change to current. If current is more than capacity, set overloaded to 1.\n\nIf overloaded is 1, show false, otherwise show true.\n","expected":"false\n","step_budget":2000000},{"id":1096,"slug":"brace-expansion-ii","title":"Brace Expansion II","difficulty":"Hard","category":"String","code":"Keep a shared current as empty text. Keep a shared pending as an empty list of text. Keep a shared finished as an empty list of text. Keep a shared pool as an empty list of text. Keep a shared prefix as empty text. Keep a shared suffix as empty text. Keep a shared inside as empty text. Keep a shared option as empty text. Keep a shared open of 0. Keep a shared close of 0. Keep a shared total of 0. Keep a shared order of 0. Keep a shared same of 0. Keep a shared candidate as empty text.\n\nTo uncover. Set open to -1. The place is 0. The last is the last position of current.\nRepeat while place is at most last and open is less than 0.\nThe symbol is the slice of current from place to place plus 1. If symbol matches \"{\", set open to place. Add 1 to place.\n\nTo enclose. Set close to -1. The depth is 0. The walk is 0. The last is the last position of current.\nRepeat while walk is at most last and close is less than 0.\nThe symbol is the slice of current from walk to walk plus 1. If symbol matches \"{\", add 1 to depth. If symbol matches \"}\", subtract 1 from depth. The closing is 0. If symbol matches \"}\", set closing to 1. If closing is 1 and depth is 0, set close to walk. Add 1 to walk.\n\nTo extend. The parts is a list of prefix, option, and suffix. The combined is join parts with \"\". Place combined into pending. Add 1 to total.\n\nTo expand inside. The start is 0. The level is 0. The spot is 0. The last is the last position of inside.\nRepeat while spot is at most last.\nThe symbol is the slice of inside from spot to spot plus 1. If symbol matches \"{\", add 1 to level. If symbol matches \"}\", subtract 1 from level. The comma is 0. If symbol matches \",\", set comma to 1. If comma is 1 and level is 0, The mark is spot, The piece is the slice of inside from start to mark, Set option to piece, Extend, Set start to spot plus 1. If spot is last, The finish is spot plus 1, The piece is the slice of inside from start to finish, Set option to piece, Extend. Add 1 to spot.\n\nTo search. Set same to 0. The spot is 0. The last is the last position of pool.\nRepeat while spot is at most last and same is 0.\nThe other is item spot of pool. If other matches candidate, set same to 1. Add 1 to spot.\n\nTo compare from left (a whole number) with right (a whole number). Set order to 0. The first is item left of pool. The second is item right of pool. The firstsize is the length of first. The secondsize is the length of second. The span is firstsize. If secondsize is less than span, set span to secondsize.\nFor every spot from 0 to span minus 1.\nThe firstsymbol is character spot of first. The secondsymbol is character spot of second. If order is 0 and firstsymbol is less than secondsymbol, set order to -1. If order is 0 and firstsymbol is more than secondsymbol, set order to 1. If order is 0 and firstsize is less than secondsize, set order to -1. If order is 0 and firstsize is more than secondsize, set order to 1.\n\nThe source is \"{a,b}{c,{d,e}}\". Set current to a copy of source. The seed is a copy of source. Place seed into pending. Set total to 1. The front is 0.\nRepeat while front is less than total.\nThe chosen is item front of pending. The next is a copy of chosen. Set current to a copy of next. Add 1 to front. Uncover. If open is less than 0, Place current into finished. If open is at least 0, Enclose. If open is at least 0, Set prefix to the slice of current from 0 to open. If open is at least 0, The begin is open plus 1, Set inside to the slice of current from begin to close. If open is at least 0, The tail is close plus 1, The end is the last position of current, The final is end plus 1, Set suffix to the slice of current from tail to final. If open is at least 0, Expand inside.\n\nFor every spot from 0 to the last position of finished.\nThe piece is item spot of finished. Set candidate to a copy of piece. Search. If same is 0, Place candidate into pool.\n\nThe lastpool is the last position of pool.\nFor every spot from 0 to lastpool minus 1.\nFor every probe from spot plus 1 to lastpool.\nCompare from spot with probe. If order is more than 0, swap item spot of pool and item probe of pool.\n\nFor each piece in pool, show piece.\n","expected":"ac\nad\nae\nbc\nbd\nbe\n","step_budget":4567555},{"id":1103,"slug":"distribute-candies-to-people","title":"Distribute Candies to People","difficulty":"Easy","category":"Math","code":"The candies is 7. The people is 4. The shares is a list of 4 zeros. The given is 0. The turn is 1.\nRepeat while candies is more than 0.\nThe person is given modulo people. The gift is turn. If gift is more than candies, set gift to candies. Increase item person of shares by gift. Subtract gift from candies. Add 1 to turn. Add 1 to given.\n\nFor each share in shares, show share.\n","expected":"1\n2\n3\n1\n","step_budget":2000000},{"id":1104,"slug":"path-in-zigzag-labelled-binary-tree","title":"Path In Zigzag Labelled Binary Tree","difficulty":"Medium","category":"Math","code":"The label is 14. The answers is an empty list of whole numbers. The node is label. Keep a shared base of 0. Keep a shared depth of 0.\nTo measure from value (a whole number). Set base to 1. Set depth to 0.\nRepeat while base times 2 is at most value.\nSet base to base times 2. Add 1 to depth.\n\nRepeat while node is more than 0.\nPlace node into answers. Measure from node. The index is node minus base. The width is base minus 1. The mirror is width minus index. The parent is base divided by 2 plus mirror divided by 2. Set node to parent.\n\nThe spot is the last position of answers.\nRepeat while spot is at least 0.\nShow item spot of answers. Subtract 1 from spot.\n","expected":"1\n3\n4\n14\n","step_budget":2000000},{"id":1105,"slug":"filling-bookcase-shelves","title":"Filling Bookcase Shelves","difficulty":"Medium","category":"Array","code":"The thickness is a list of 1, 2, 2, 1, 1, 1, and 1. The tallness is a list of 1, 3, 3, 1, 1, 1, and 2. The shelf is 4. The count is 7. The costs is a list of 8 zeros. Set item 0 of costs to 0.\nFor every book from 1 to count.\nSet item book of costs to 1000000. The width is 0. The height is 0. The start is book minus 1. The need is item start of thickness.\nRepeat while start is at least 0 and need is at most shelf.\nThe thick is item start of thickness. The tall is item start of tallness. Add thick to width. If tall is more than height, set height to tall. The candidate is item start of costs plus height. If candidate is less than item book of costs, set item book of costs to candidate. Subtract 1 from start. If start is at least 0, The nextthick is item start of thickness, set need to width plus nextthick.\n\nShow item count of costs.\n","expected":"6\n","step_budget":2000000},{"id":1106,"slug":"parsing-a-boolean-expression","title":"Parsing A Boolean Expression","difficulty":"Hard","category":"String","code":"Keep a shared source as empty text. Place \"|(&(t,f,t),!(t))\" into source. Keep a shared cursor of 0. Keep a shared value of 0.\nTo parse. The index is cursor. The symbol is the slice of source from index to index plus 1. If symbol matches \"t\", set value to 1, add 1 to cursor, return. If symbol matches \"f\", set value to 0, add 1 to cursor, return. If symbol matches \"!\", Negate. If symbol matches \"&\", Conjoin. If symbol matches \"|\", Disjoin.\n\nTo negate. Add 2 to cursor. Parse. The inside is value. Add 1 to cursor. Set value to 1 minus inside.\n\nTo conjoin. Add 2 to cursor. The total is 1. The index is cursor. The symbol is the slice of source from index to index plus 1.\nRepeat while symbol does not match \")\".\nParse. Set total to total times value. The index is cursor. The symbol is the slice of source from index to index plus 1. If symbol matches \",\", add 1 to cursor. If symbol matches \")\", add 1 to cursor. Set value to total.\n\nTo disjoin. Add 2 to cursor. The total is 0. The index is cursor. The symbol is the slice of source from index to index plus 1.\nRepeat while symbol does not match \")\".\nParse. Increase total by value. The index is cursor. The symbol is the slice of source from index to index plus 1. If symbol matches \",\", add 1 to cursor. If symbol matches \")\", add 1 to cursor. Set value to total.\n\nParse. If value is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":1108,"slug":"defanging-an-ip-address","title":"Defanging an IP Address","difficulty":"Easy","category":"String","code":"The source is \"1.1.1.1\". The parts is an empty list of text.\nFor every spot from 0 to the last position of source.\nThe symbol is the slice of source from spot to spot plus 1. If symbol matches \".\", Place \"[.]\" into parts, otherwise Place symbol into parts.\n\nThe result is join parts with \"\". Show result.\n","expected":"1[.]1[.]1[.]1\n","step_budget":2000000},{"id":1109,"slug":"corporate-flight-bookings","title":"Corporate Flight Bookings","difficulty":"Medium","category":"Array","code":"The bookings is a list of 1, 2, 10, 2, 3, 20, 2, 5, and 25. The flights is 5. The changes is a list of 7 zeros.\nFor every booking from 0 to 2.\nThe base is booking times 3. The first is item base of bookings. The last is item (base plus 1) of bookings. The seats is item (base plus 2) of bookings. Increase item (first minus 1) of changes by seats. Decrease item last of changes by seats.\n\nThe running is 0.\nFor every flight from 0 to flights minus 1.\nThe change is item flight of changes. Add change to running. Show running.\n","expected":"10\n55\n45\n25\n25\n","step_budget":2000000},{"id":1110,"slug":"delete-nodes-and-return-forest","title":"Delete Nodes And Return Forest","difficulty":"Medium","category":"Array","code":"Keep a shared values holding 1, 2, 3, 4, 5, 6, and 7. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, and -1. Keep a shared removed holding 0, 0, 0, 0, 0, 0, and 0. Set item 2 of removed to 1. Set item 4 of removed to 1. Keep a shared roots as an empty list of whole numbers. Keep a shared order as an empty list of whole numbers. Keep a shared begin of 0. Keep a shared final of 0.\n\nTo discard from node (a whole number). The left is item node of lefts. The right is item node of rights. If left is at least 0, Prune from left with 1. If right is at least 0, Prune from right with 1.\n\nTo prune from node (a whole number) with rootflag (a whole number). If node is less than 0, return. If item node of removed is 1, Discard from node, return. If rootflag is 1, Place node into roots. The left is item node of lefts. The right is item node of rights. If left is at least 0 and item left of removed is 0, Prune from left with 0. If left is at least 0 and item left of removed is 1, Set item node of lefts to -1, Prune from left with 1. If right is at least 0 and item right of removed is 0, Prune from right with 0. If right is at least 0 and item right of removed is 1, Set item node of rights to -1, Prune from right with 1.\n\nTo walk from start (a whole number). The queue is a list of 64 zeros. Set item 0 of queue to start. The head is 0. The count is 1.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The content is 0. The left is 0. The right is 0. If node is at least 0, set content to item node of values. If node is at least 0, set left to item node of lefts. If node is at least 0, set right to item node of rights. If node is less than 0, Place -1 into order. If node is at least 0, Place content into order. If node is at least 0, The slotone is count, Set item slotone of queue to left, Add 1 to count. If node is at least 0, The slottwo is count, Set item slottwo of queue to right, Add 1 to count.\n\nTo trim. The spot is the last position of order. Set final to spot.\nRepeat while spot is at least begin and item spot of order is -1.\nDecrease spot by 1. Set final to spot.\n\nTo display. The parts is an empty list of text.\nFor every slot from begin to final.\nThe value is item slot of order. The piece is format whole number value as text. Place piece into parts. If slot is final, The line is join parts with \",\", Show line.\n\nPrune from 0 with 1.\nFor every which from 0 to the last position of roots.\nThe start is item which of roots. The prior is the last position of order. Set begin to prior plus 1. Walk from start. Trim. Display.\n","expected":"1,2,-1,4\n6\n7\n","step_budget":2000000},{"id":1111,"slug":"maximum-nesting-depth-of-two-valid-parentheses-strings","title":"Maximum Nesting Depth of Two Valid Parentheses Strings","difficulty":"Medium","category":"String","code":"The sequence is \"(()())\". The answers is an empty list of whole numbers. The depth is 0. The last is the last position of sequence.\nFor every spot from 0 to last.\nThe symbol is the slice of sequence from spot to spot plus 1. If symbol matches \"(\", The opening is depth modulo 2, Place opening into answers, Add 1 to depth. If symbol matches \")\", subtract 1 from depth. If symbol matches \")\", The closing is depth modulo 2, Place closing into answers.\n\nThe parts is an empty list of text.\nFor each choice in answers.\nThe piece is format whole number choice as text. Place piece into parts.\n\nThe line is join parts with \",\". Show line.\n","expected":"0,1,1,1,1,0\n","step_budget":2000000},{"id":1122,"slug":"relative-sort-array","title":"Relative Sort Array","difficulty":"Easy","category":"Array","code":"The numbers is a list of 2, 3, 1, 3, 2, 4, 6, 7, 9, 2, and 19. The wanted is a list of 2, 1, 4, 3, 9, and 6. The counts is a list of 1001 zeros.\nFor each value in numbers.\nIncrease item value of counts by 1.\n\nThe answers is an empty list of whole numbers.\nFor every spot from 0 to the last position of wanted.\nThe value is item spot of wanted. The many is item value of counts. Set item value of counts to 0.\nFor every repeat from 1 to many.\nPlace value into answers.\n\nFor every value from 0 to 1000.\nThe many is item value of counts.\nIf many is more than 0.\nFor every repeat from 1 to many.\nPlace value into answers.\n\nThe parts is an empty list of text.\nFor each value in answers.\nThe piece is format whole number value as text. Place piece into parts.\n\nThe line is join parts with \",\". Show line.\n","expected":"2,2,2,1,4,3,3,9,6,7,19\n","step_budget":2000000},{"id":1123,"slug":"lowest-common-ancestor-of-deepest-leaves","title":"Lowest Common Ancestor of Deepest Leaves","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 3, 5, 1, 6, 2, 0, 8, -1, -1, 7, and 4. Keep a shared lefts holding 1, 3, 5, -1, 9, -1, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, 10, -1, -1, -1, -1, -1, and -1. Keep a shared depths as an empty list of whole numbers.\nFor every node from 0 to 10.\nPlace 0 into depths.\n\nKeep a shared ancestors as an empty list of whole numbers.\nFor every node from 0 to 10.\nPlace 0 into ancestors.\n\nTo score 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. Score from left. Score from right. The leftdepth is -1. If left is at least 0, set leftdepth to item left of depths. The rightdepth is -1. If right is at least 0, set rightdepth to item right of depths. If leftdepth is more than rightdepth, Set item node of depths to leftdepth plus 1, Set item node of ancestors to item left of ancestors. If rightdepth is more than leftdepth, Set item node of depths to rightdepth plus 1, Set item node of ancestors to item right of ancestors. If leftdepth is rightdepth, Set item node of depths to leftdepth plus 1, Set item node of ancestors to node.\n\nScore from 0. The answer is item 0 of ancestors. The queue is a list of 32 zeros. Set item 0 of queue to answer. The head is 0. The count is 1. The order is an empty list of whole numbers.\nRepeat while head is less than count.\nThe node is item head of queue. Add 1 to head. The value is item node of values. Place value into order. The left is item node of lefts. The right is item node of rights. If left is at least 0, Set item count of queue to left, Add 1 to count. If right is at least 0, Set item count of queue to right, Add 1 to count.\n\nThe parts is an empty list of text.\nFor each value in order.\nThe piece is format whole number value as text. Place piece into parts.\n\nThe line is join parts with \",\". Show line.\n","expected":"2,7,4\n","step_budget":2000000},{"id":1124,"slug":"longest-well-performing-interval","title":"Longest Well-Performing Interval","difficulty":"Medium","category":"Array","code":"The hours is a list of 9, 9, 6, 0, 6, 6, and 9. The count is 7. The offset is count. The earliest is a list of 15 zeros.\nFor every spot from 0 to 14.\nSet item spot of earliest to -2.\n\nThe score is 0. The best is 0.\nFor every spot from 0 to count minus 1.\nThe value is item spot of hours. If value is more than 8, add 1 to score, otherwise subtract 1 from score. The length is 0. If score is more than 0, set length to spot plus 1. The prior is score minus 1 plus offset. The seen is -2. If prior is at least 0, set seen to item prior of earliest. If score is at most 0 and seen is not -2, set length to spot minus seen. If length is more than best, set best to length. The here is score plus offset. If item here of earliest is -2, set item here of earliest to spot.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":1125,"slug":"smallest-sufficient-team","title":"Smallest Sufficient Team","difficulty":"Hard","category":"Array","code":"The requireds is a list of \"java\", \"nodejs\", and \"reactjs\". The skills is a list of \"java\", \"nodejs\", \"nodejs\", and \"reactjs\". The starts is a list of 0, 1, and 2. The counts is a list of 1, 1, and 2. The masks is a list of 3 zeros.\nFor every person from 0 to 2.\nThe mask is 0.\nFor every want from 0 to 2.\nThe required is item want of requireds. The bit is shift 1 left by want. The begin is item person of starts. The many is item person of counts. The finish is begin plus many minus 1.\nFor every entry from begin to finish.\nThe skill is item entry of skills. If skill matches required, set mask to bitwise or of mask and bit. Set item person of masks to mask.\n\nThe best is a list of 8 zeros. Set item 0 of best to 0.\nFor every state from 1 to 7.\nSet item state of best to 1000000.\n\nThe chooser is a list of 8 zeros. The previous is a list of 8 zeros. The full is 7.\nFor every person from 0 to 2.\nThe gain is item person of masks. The state is full.\nRepeat while state is at least 0.\nThe here is item state of best. The nextstate is bitwise or of state and gain. The candidate is here plus 1. If here is less than 1000000 and candidate is less than item nextstate of best, Set item nextstate of best to candidate, Set item nextstate of chooser to person, Set item nextstate of previous to state. Subtract 1 from state.\n\nThe answers is an empty list of whole numbers. The state is full.\nRepeat while state is more than 0.\nThe person is item state of chooser. Place person into answers. The prior is item state of previous. Set state to prior.\n\nThe parts is an empty list of text. The spot is the last position of answers.\nRepeat while spot is at least 0.\nThe person is item spot of answers. The piece is format whole number person as text. Place piece into parts. Subtract 1 from spot.\n\nThe line is join parts with \",\". Show line.\n","expected":"0,2\n","step_budget":2000000},{"id":1128,"slug":"number-of-equivalent-domino-pairs","title":"Number of Equivalent Domino Pairs","difficulty":"Easy","category":"Array","code":"The dominoes is a list of 1, 2, 2, 1, 3, 4, 5, and 6. The counts is a list of 100 zeros. The total is 0.\nFor every domino from 0 to 3.\nThe base is domino times 2. The one is item base of dominoes. The other is item (base plus 1) of dominoes. The low is one. The high is other. If one is more than other, set low to other, set high to one. The key is low times 10 plus high. The seen is item key of counts. Add seen to total. Set item key of counts to seen plus 1.\n\nShow total.\n","expected":"1\n","step_budget":2000000},{"id":1129,"slug":"shortest-path-with-alternating-colors","title":"Shortest Path with Alternating Colors","difficulty":"Medium","category":"Breadth-First Search","code":"Keep a shared reds as a list of 9 zeros. Set item 1 of reds to 1. Set item 5 of reds to 1. Keep a shared blues as a list of 9 zeros. Keep a shared nodes as an empty list of whole numbers. Keep a shared colors as an empty list of whole numbers. Keep a shared steps as an empty list of whole numbers. Keep a shared seen as a list of 6 zeros. Keep a shared answers holding -1, -1, and -1. Keep a shared count of 0. Keep a shared head of 0. Place 0 into nodes. Place 0 into colors. Place 0 into steps. Place 0 into nodes. Place 1 into colors. Place 0 into steps. Set count to 2. Set item 0 of seen to 1. Set item 1 of seen to 1.\n\nRepeat while head is less than count.\nThe front is head. The currentnode is item front of nodes. The currentcolor is item front of colors. The currentstep is item front of steps. Add 1 to head. If item currentnode of answers is -1, set item currentnode of answers to currentstep. The nextcolor is 1 minus currentcolor.\nFor every next from 0 to 2.\nThe edge is 0. If nextcolor is 0 and item (currentnode times 3 plus next) of reds is 1, set edge to 1. If nextcolor is 1 and item (currentnode times 3 plus next) of blues is 1, set edge to 1. The mark is next times 2 plus nextcolor. If edge is 1 and item mark of seen is 0, set item mark of seen to 1, Place next into nodes, Place nextcolor into colors, Place (currentstep plus 1) into steps, add 1 to count.\n\nFor each value in answers, show value.\n","expected":"0\n1\n-1\n","step_budget":2000000},{"id":1130,"slug":"minimum-cost-tree-from-leaf-values","title":"Minimum Cost Tree From Leaf Values","difficulty":"Medium","category":"Array","code":"The leaves is a list of 6, 2, and 4. The count is 3. The costs is a list of 9 zeros. The peaks is a list of 9 zeros.\nFor every spot from 0 to 2.\nSet item (spot times count plus spot) of peaks to item spot of leaves.\n\nFor every span from 2 to count.\nFor every start from 0 to count minus span.\nThe end is start plus span minus 1. The best is 100000000. The tallpair is 0.\nFor every split from start to end minus 1.\nThe leftpeak is item (start times count plus split) of peaks. The rightpeak is item ((split plus 1) times count plus end) of peaks. The pair is leftpeak times rightpeak. The cost is item (start times count plus split) of costs plus item ((split plus 1) times count plus end) of costs plus pair. If cost is less than best, set best to cost, set tallpair to the larger of leftpeak and rightpeak. Set item (start times count plus end) of costs to best. Set item (start times count plus end) of peaks to tallpair.\n\nShow item (count minus 1) of costs.\n","expected":"32\n","step_budget":2000000},{"id":1131,"slug":"maximum-of-absolute-value-expression","title":"Maximum of Absolute Value Expression","difficulty":"Medium","category":"Array","code":"The firsts is a list of 1, 2, 3, and 4. The seconds is a list of -1, 4, 5, and 6. The best is 0.\nFor every left from 0 to 3.\nFor every right from 0 to 3.\nThe firstgap is the absolute value of (item left of firsts minus item right of firsts). The secondgap is the absolute value of (item left of seconds minus item right of seconds). The indexgap is the absolute value of (left minus right). The score is firstgap plus secondgap plus indexgap. If score is more than best, set best to score.\n\nShow best.\n","expected":"13\n","step_budget":2000000},{"id":1137,"slug":"n-th-tribonacci-number","title":"N-th Tribonacci Number","difficulty":"Easy","category":"Math","code":"The wanted is 25. The older is 0. The middle is 1. The newer is 1. The spot is 3.\nRepeat while spot is at most wanted.\nThe next is older plus middle plus newer. Set older to middle. Set middle to newer. Set newer to next. Add 1 to spot.\n\nShow newer.\n","expected":"1389537\n","step_budget":2000000},{"id":1138,"slug":"alphabet-board-path","title":"Alphabet Board Path","difficulty":"Medium","category":"String","code":"The target is \"leet\". The moves is an empty list of text. The line is 0. The column is 0. The last is the last position of target.\nFor every spot from 0 to last.\nThe symbol is character spot of target. The code is symbol minus character 0 of \"a\". The wantline is code divided by 5. The wantcolumn is code modulo 5. Repeat while line is less than wantline, Place \"D\" into moves, Add 1 to line. Repeat while line is more than wantline, Place \"U\" into moves, Subtract 1 from line. Repeat while column is less than wantcolumn, Place \"R\" into moves, Add 1 to column. Repeat while column is more than wantcolumn, Place \"L\" into moves, Subtract 1 from column. Place \"!\" into moves.\n\nThe path is join moves with \"\". Show path.\n","expected":"DDR!UURRR!!DDD!\n","step_budget":2000000},{"id":1139,"slug":"largest-1-bordered-square","title":"Largest 1-Bordered Square","difficulty":"Medium","category":"Array","code":"The grid is a list of 1, 1, 1, 1, 0, 1, 1, 1, and 1. The size is 3. The best is 0.\nFor every side from 1 to size.\nFor every top from 0 to size minus side.\nFor every left from 0 to size minus side.\nThe bottom is top plus side minus 1. The right is left plus side minus 1. The good is 1.\nFor every step from 0 to side minus 1.\nThe upper is item (top times size plus left plus step) of grid. The lower is item (bottom times size plus left plus step) of grid. The western is item ((top plus step) times size plus left) of grid. The eastern is item ((top plus step) times size plus right) of grid. If upper is 0, set good to 0. If lower is 0, set good to 0. If western is 0, set good to 0. If eastern is 0, set good to 0. If good is 1 and side times side is more than best, set best to side times side.\n\nShow best.\n","expected":"9\n","step_budget":2000000},{"id":1140,"slug":"stone-game-ii","title":"Stone Game II","difficulty":"Medium","category":"Array","code":"Keep a shared stones holding 2, 7, 9, 4, and 4. Keep a shared count of 5. Keep a shared tail as a list of 6 zeros. The spot is count minus 1.\nRepeat while spot is at least 0.\nThe after is spot plus 1. Set item spot of tail to item after of tail plus item spot of stones. Subtract 1 from spot.\n\nKeep a shared table as an empty list of whole numbers. For every slot from 0 to 35, Place -1 into table. Keep a shared gathered of 0.\n\nTo gather from start (a whole number) with limit (a whole number). The slot is start times 6 plus limit. If item slot of table is at least 0, set gathered to item slot of table, return. If start is at least count, set gathered to 0, set item slot of table to 0, return. The reach is limit times 2. If reach is more than count minus start, set reach to count minus start. The best is 0.\nFor every take from 1 to reach.\nThe grown is limit. If take is more than grown, set grown to take. Gather from start plus take with grown. The offered is item start of tail minus gathered. If offered is more than best, set best to offered. Set item slot of table to best. Set gathered to best.\n\nGather from 0 with 1. Show gathered.\n","expected":"10\n","step_budget":2000000},{"id":1143,"slug":"longest-common-subsequence","title":"Longest Common Subsequence","difficulty":"Medium","category":"String","code":"The first is \"abcde\". The second is \"ace\". The firstsize is the number of characters in first. The secondsize is the number of characters in second. The width is secondsize plus 1. The size is (firstsize plus 1) times width. The lengths is a list of size zeros.\nFor every left from 1 to firstsize.\nFor every right from 1 to secondsize.\nThe here is left times width plus right. The same is 0. If character (left minus 1) of first is character (right minus 1) of second, set same to 1. The upper is item (left times width plus right minus width) of lengths. The western is item (left times width plus right minus 1) of lengths. The diagonal is item (left times width plus right minus width minus 1) of lengths. The best is the larger of upper and western. If same is 1, set item here of lengths to diagonal plus 1. If same is 0, set item here of lengths to best.\n\nThe answer is item (firstsize times width plus secondsize) of lengths. Show answer.\n","expected":"3\n","step_budget":2000000},{"id":1144,"slug":"decrease-elements-to-make-array-zigzag","title":"Decrease Elements To Make Array Zigzag","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 9, 6, 1, 6, and 2. Keep a shared count of 5. Keep a shared trial as a list of 5 zeros. Keep a shared cost of 0.\n\nTo score with parity (a whole number). For every spot from 0 to count minus 1, set item spot of trial to item spot of numbers. Set cost to 0.\nFor every spot from 1 to count minus 1.\nIf spot modulo 2 is parity and item spot of trial is at most item (spot minus 1) of trial, The gap is item (spot minus 1) of trial minus item spot of trial plus 1, add gap to cost, set item (spot minus 1) of trial to item spot of trial minus 1. If spot modulo 2 is not parity and item spot of trial is at least item (spot minus 1) of trial, The gap is item spot of trial minus item (spot minus 1) of trial plus 1, add gap to cost, set item spot of trial to item (spot minus 1) of trial minus 1.\n\nScore with 0. The evencost is cost. Score with 1. The oddcost is cost. The answer is the smaller of evencost and oddcost. Show answer.\n","expected":"4\n","step_budget":2000000},{"id":1145,"slug":"binary-tree-coloring-game","title":"Binary Tree Coloring Game","difficulty":"Medium","category":"Depth-First Search","code":"The values is a list of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and 11. The count is 11. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers.\nFor every node from 0 to 10.\nThe left is node times 2 plus 1. The right is node times 2 plus 2. If left is at least count, set left to -1. If right is at least count, set right to -1. Place left into lefts. Place right into rights.\n\nKeep a shared counted of 0.\n\nTo tally from node (a whole number). If node is less than 0, set counted to 0, return. The left is item node of lefts. The right is item node of rights. Tally from left. The leftsize is counted. Tally from right. The rightsize is counted. Set counted to leftsize plus rightsize plus 1.\n\nThe chosen is 3. The red is chosen minus 1. Tally from item red of lefts. The leftsize is counted. Tally from item red of rights. The rightsize is counted. Tally from red. The redsize is counted. The rest is count minus redsize. The bigger is the larger of leftsize and rightsize. The biggest is the larger of bigger and rest. If biggest times 2 is more than count, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1147,"slug":"longest-chunked-palindrome-decomposition","title":"Longest Chunked Palindrome Decomposition","difficulty":"Hard","category":"String","code":"Keep a shared text as empty text. Place \"ghiabcdefhelloadamhelloabcdefghi\" into text. Keep a shared left of 0. Keep a shared right of the last position of text. Keep a shared pieces of 0. Keep a shared found of 0.\n\nTo seek. Set found to 0. The reach is (right minus left plus 1) divided by 2.\nFor every span from 1 to reach.\nThe front is the slice of text from left to left plus span. The back is the slice of text from right minus span plus 1 to right plus 1. The equal is 0. If front matches back, set equal to 1. If equal is 1 and found is 0, add 2 to pieces, set left to left plus span, set right to right minus span, set found to 1, stop.\n\nRepeat while left is at most right.\nIf left is right, add 1 to pieces, set left to right plus 1, stop. Seek. If found is 0, add 1 to pieces, set left to right plus 1.\n\nShow pieces.\n","expected":"7\n","step_budget":2000000},{"id":1154,"slug":"day-of-the-year","title":"Day of the Year","difficulty":"Easy","category":"String","code":"The date is \"2019-02-10\". The lengths is a list of 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, and 31. The digit is 0. The year is the digit value of character 0 of date. Set digit to the digit value of character 1 of date. Set year to year times 10 plus digit. Set digit to the digit value of character 2 of date. Set year to year times 10 plus digit. Set digit to the digit value of character 3 of date. Set year to year times 10 plus digit. The month is the digit value of character 5 of date. Set digit to the digit value of character 6 of date. Set month to month times 10 plus digit. The day is the digit value of character 8 of date. Set digit to the digit value of character 9 of date. Set day to day times 10 plus digit. The leap is 0. If year modulo 4 is 0 and year modulo 100 is not 0, set leap to 1. If year modulo 400 is 0, set leap to 1. The total is 0.\nFor every which from 0 to month minus 2.\nIncrease total by item which of lengths. Increase total by day. If leap is 1 and month is more than 2, add 1 to total.\n\nShow total.\n","expected":"41\n","step_budget":2000000},{"id":1155,"slug":"number-of-dice-rolls-with-target-sum","title":"Number of Dice Rolls With Target Sum","difficulty":"Medium","category":"Dynamic Programming","code":"The dice is 2. The faces is 6. The wanted is 7. The width is wanted plus 1. The size is (dice plus 1) times width. The ways is a list of size zeros. Set item 0 of ways to 1.\nFor every die from 1 to dice.\nFor every sum from 1 to wanted.\nFor every face from 1 to faces.\nIf sum is at least face.\nThe earlier is sum minus face. The here is die times width plus sum. The before is (die minus 1) times width plus earlier. The gain is item before of ways. Set item here of ways to (item here of ways plus gain) modulo 1000000007.\n\nThe answer is item (dice times width plus wanted) of ways. Show answer.\n","expected":"6\n","step_budget":2000000},{"id":1156,"slug":"swap-for-longest-repeated-character-substring","title":"Swap For Longest Repeated Character Substring","difficulty":"Medium","category":"String","code":"Keep a shared text as empty text. Place \"aaabaaa\" into text. Keep a shared wanted as empty text. Keep a shared total of 0. Keep a shared best of 0. Keep a shared lastindex of the last position of text.\nTo tally from spot (a whole number). If spot is more than lastindex, return. If the slice of text from spot to spot plus 1 matches wanted, add 1 to total. Tally from spot plus 1.\n\nTo scan from seed (a whole number). Set wanted to the slice of text from seed to seed plus 1. Set total to 0. Tally from 0.\nFor every start from 0 to lastindex.\nThe matching is 0.\nFor every finish from start to lastindex.\nIf the slice of text from finish to finish plus 1 matches wanted, add 1 to matching. The span is finish minus start plus 1. The spare is total minus matching. The cap is total. If spare is more than 0, set cap to total plus 1. The candidate is span. If candidate is more than cap, set candidate to cap. If span minus matching is at most 1 and candidate is more than best, set best to candidate.\n\nFor every seed from 0 to lastindex.\nScan from seed.\n\nShow best.\n","expected":"6\n","step_budget":2382442},{"id":1160,"slug":"find-words-that-can-be-formed-by-characters","title":"Find Words That Can Be Formed by Characters","difficulty":"Easy","category":"Array","code":"The words is a list of \"cat\", \"bt\", \"hat\", and \"tree\". The available is \"atach\". The total is 0.\nFor each word in words.\nThe good is 1. The last is the last position of word.\nFor every spot from 0 to last.\nThe symbol is the slice of word from spot to spot plus 1. The needed is 0. The offered is 0. For every other from 0 to last, if the slice of word from other to other plus 1 matches symbol, add 1 to needed. For every other from 0 to the last position of available, if the slice of available from other to other plus 1 matches symbol, add 1 to offered. If needed is more than offered, set good to 0. If spot is last and good is 1, add (last plus 1) to total.\n\nShow total.\n","expected":"6\n","step_budget":2000000},{"id":1161,"slug":"maximum-level-sum-of-a-binary-tree","title":"Maximum Level Sum of a Binary Tree","difficulty":"Medium","category":"Depth-First Search","code":"The values is a list of 1, 7, 0, 7, -8, -1000000, and -1000000. The count is 7. The empty is -1000000. The lefts is an empty list of whole numbers. The rights is an empty list of whole numbers.\nFor every node from 0 to 6.\nThe left is node times 2 plus 1. The right is node times 2 plus 2. If left is at least count, set left to -1. If right is at least count, set right to -1. Place left into lefts. Place right into rights.\n\nThe queue is an empty list of whole numbers. The depths is an empty list of whole numbers. Place 0 into queue. Place 1 into depths. The head is 0. The held is 1. The level is 1. The leveltotal is 0. The best is -1000000. The answer is 1.\nRepeat while head is less than held.\nThe front is head. The node is item front of queue. The depth is item front of depths. If depth is not level, Set best to the larger of best and leveltotal, Set answer to level, Set level to depth, Set leveltotal to 0. Increase leveltotal by item node of values. The left is item node of lefts. The right is item node of rights. If left is at least 0 and item left of values is not -1000000, Place left into queue, Place (depth plus 1) into depths, add 1 to held. If right is at least 0 and item right of values is not -1000000, Place right into queue, Place (depth plus 1) into depths, add 1 to held. Add 1 to head.\n\nIf leveltotal is more than best, Set best to leveltotal, Set answer to level. Show answer.\n","expected":"2\n","step_budget":2000000},{"id":1162,"slug":"as-far-from-land-as-possible","title":"As Far from Land as Possible","difficulty":"Medium","category":"Array","code":"Keep a shared active of 0. Keep a shared size of 3. The lands is a list of 1, 0, 1, 0, 0, 0, 1, 0, and 1. Keep a shared distances as an empty list of whole numbers. For every cell from 0 to 8, Place -1 into distances. Keep a shared queue as an empty list of whole numbers. Keep a shared count of 0.\nFor every cell from 0 to 8.\nIf item cell of lands is 1, set item cell of distances to 0, Place cell into queue, add 1 to count.\n\nTo relax with target (a whole number). The here is active. If item target of distances is at least 0, return. Set item target of distances to item here of distances plus 1. Place target into queue. Add 1 to count.\n\nTo spread. The band is active divided by size. The column is active modulo size. If band is more than 0, Relax with active minus size. If band is less than size minus 1, Relax with active plus size. If column is more than 0, Relax with active minus 1. If column is less than size minus 1, Relax with active plus 1.\n\nThe head is 0.\nRepeat while head is less than count.\nThe front is head. Set active to item front of queue. Add 1 to head. Spread.\n\nThe best is -1.\nFor every cell from 0 to 8.\nIf item cell of distances is more than best, set best to item cell of distances.\n\nIf best is 0, show -1, otherwise show best.\n","expected":"2\n","step_budget":2000000},{"id":1163,"slug":"last-substring-in-lexicographical-order","title":"Last Substring in Lexicographical Order","difficulty":"Hard","category":"String","code":"The text is \"abab\". The last is the last position of text. The best is the slice of text from 0 to last plus 1.\nFor every start from 1 to last.\nThe candidate is the slice of text from start to last plus 1. The better is 0. If best comes before candidate, set better to 1. If better is 1, Set best to a copy of candidate.\n\nShow best.\n","expected":"bab\n","step_budget":2000000},{"id":1169,"slug":"invalid-transactions","title":"Invalid Transactions","difficulty":"Medium","category":"Array","code":"The records is a list of \"alice,20,800,mtv\", and \"alice,50,100,beijing\". The names is an empty list of text. The times is an empty list of whole numbers. The amounts is an empty list of whole numbers. The cities is an empty list of text. The invalid is an empty list of whole numbers. The lastrecord is the last position of records.\nFor each record in records.\nThe parts is split record by \",\". The name is item 0 of parts. The timepiece is item 1 of parts. The amountpiece is item 2 of parts. The city is item 3 of parts. The time is the digit value of character 0 of timepiece. The digit is 0. If the length of timepiece is more than 1, Set digit to the digit value of character 1 of timepiece, Set time to time times 10 plus digit. If the length of timepiece is more than 2, Set digit to the digit value of character 2 of timepiece, Set time to time times 10 plus digit. If the length of timepiece is more than 3, Set digit to the digit value of character 3 of timepiece, Set time to time times 10 plus digit. The amount is the digit value of character 0 of amountpiece. If the length of amountpiece is more than 1, Set digit to the digit value of character 1 of amountpiece, Set amount to amount times 10 plus digit. If the length of amountpiece is more than 2, Set digit to the digit value of character 2 of amountpiece, Set amount to amount times 10 plus digit. If the length of amountpiece is more than 3, Set digit to the digit value of character 3 of amountpiece, Set amount to amount times 10 plus digit. Place name into names. Place time into times. Place amount into amounts. Place city into cities. Place 0 into invalid.\n\nFor every left from 0 to lastrecord.\nIf item left of amounts is more than 1000, set item left of invalid to 1.\nFor every right from 0 to lastrecord.\nThe gap is item left of times minus item right of times. Set gap to the absolute value of gap. The samecity is 0. The samename is 0. If item left of cities matches item right of cities, set samecity to 1. If item left of names matches item right of names, set samename to 1. If left is not right and samename is 1 and samecity is 0 and gap is at most 60, set item left of invalid to 1.\n\nFor every left from 0 to lastrecord.\nIf item left of invalid is 1, Show item left of records.\n","expected":"alice,20,800,mtv\nalice,50,100,beijing\n","step_budget":2000000},{"id":1170,"slug":"compare-strings-by-frequency-of-the-smallest-character","title":"Compare Strings by Frequency of the Smallest Character","difficulty":"Medium","category":"Array","code":"Keep a shared current as empty text. Keep a shared weight of 0.\n\nTo weigh. The ordered is sort characters of current. The smallest is character 0 of ordered. The total is 0. For every spot from 0 to the last position of ordered, if character spot of ordered is smallest, add 1 to total. Set weight to total.\n\nThe queries is a list of \"bbb\", and \"cc\". The words is a list of \"a\", \"aa\", \"aaa\", and \"aaaa\". The wordlast is the last position of words.\nFor each query in queries.\nSet current to a copy of query. Weigh. The wanted is weight. The total is 0.\nFor every which from 0 to wordlast.\nSet current to item which of words. Weigh. If weight is more than wanted, add 1 to total. If which is wordlast, Show total.\n","expected":"1\n2\n","step_budget":2000000},{"id":1171,"slug":"remove-zero-sum-consecutive-nodes-from-linked-list","title":"Remove Zero Sum Consecutive Nodes from Linked List","difficulty":"Medium","category":"Linked List","code":"Keep a shared values holding 1, 2, -3, 3, and 1.\n\nKeep a shared nexts holding 1, 2, 3, 4, -1, and 0.\n\nKeep a shared keys as an empty list of whole numbers. Keep a shared places as an empty list of whole numbers. Place 0 into keys. Place 5 into places. Keep a shared running of 0. Keep a shared found of 0.\n\nTo seek from target (a whole number) with node (a whole number). Set found to 0. The size is the last position of keys.\nFor every seen from 0 to size.\nIf item seen of keys is target, set item (item seen of places) of nexts to item node of nexts, set found to 1, stop. If found is 0, Place target into keys, Place node into places.\n\nFor every node from 0 to 4.\nThe value is item node of values. Increase running by value. Seek from running with node.\n\nThe line is empty text. The node is item 5 of nexts.\nRepeat while node is at least 0.\nThe value is item node of values. The word is format whole number value as text. If the length of line is more than 0, Place \",\" into line. Place word into line. Set node to item node of nexts.\n\nShow line.\n","expected":"3,1\n","step_budget":2000000},{"id":1175,"slug":"prime-arrangements","title":"Prime Arrangements","difficulty":"Easy","category":"Math","code":"Keep a shared prime of 0.\n\nTo check from value (a whole number). Set prime to 0. If value is less than 2, return. Set prime to 1. The limit is value minus 1.\nFor every divisor from 2 to limit.\nIf value modulo divisor is 0, set prime to 0, stop.\n\nThe size is 100. The primes is 0. The rest is 0.\nFor every value from 1 to size.\nCheck from value. If prime is 1, add 1 to primes. If prime is 0, add 1 to rest.\n\nThe modulus is 1000000007. The answer is 1.\nFor every value from 2 to primes.\nSet answer to (answer times value) modulo modulus.\n\nFor every value from 2 to rest.\nSet answer to (answer times value) modulo modulus.\n\nShow answer.\n","expected":"682289015\n","step_budget":2000000},{"id":1177,"slug":"can-make-palindrome-from-substring","title":"Can Make Palindrome from Substring","difficulty":"Medium","category":"Array","code":"Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared symbol as empty text. Keep a shared position of 0. Keep a shared odd of 0. Keep a shared mask of 0. Keep a shared source as empty text. Place \"abcda\" into source.\n\nTo locate from spot (a whole number). The letter is the slice of alphabet from spot to spot plus 1. If letter matches symbol, set position to spot, return. Locate from spot plus 1.\n\nTo count from left (a whole number) with right (a whole number). Set odd to 0. Set mask to 0.\nFor every spot from left to right.\nThe piece is the slice of source from spot to spot plus 1. Set symbol to piece. Locate from 0. The bit is shift 1 left by position. The was is bitwise and of mask and bit. If was is more than 0, subtract 1 from odd. If was is 0, add 1 to odd. Set mask to exclusive or of mask and bit.\n\nThe queries is a list of 3, 3, 0, 1, 2, 0, 0, 3, 1, 0, 3, 2, 0, 4, and 1.\nFor every query from 0 to 4.\nThe left is item (query times 3) of queries. The right is item (query times 3 plus 1) of queries. The budget is item (query times 3 plus 2) of queries. Count from left with right. The pairs is odd divided by 2. If pairs is at most budget, show true, otherwise show false.\n","expected":"true\nfalse\nfalse\ntrue\ntrue\n","step_budget":2000000},{"id":1178,"slug":"number-of-valid-words-for-each-puzzle","title":"Number of Valid Words for Each Puzzle","difficulty":"Hard","category":"Array","code":"Keep a shared wordmasks holding 1, 262145, 2067, 17303811, 524293, 671749, and 262165. Keep a shared puzzlemasks holding 52445203, 50479115, 1837075, 50741251, 34471957, and 63176769. Keep a shared firstbits holding 1, 1, 1, 1, 1, and 64. Keep a shared counts as an empty list of whole numbers. Keep a shared count of 0.\nTo judge from puzzle (a whole number) with word (a whole number). If word is more than 6, Place count into counts, return. The pmask is item puzzle of puzzlemasks. The pfirst is item puzzle of firstbits. The wmask is item word of wordmasks. The firstok is bitwise and of wmask and pfirst. The subset is bitwise and of wmask and pmask. If firstok is not 0 and subset is wmask, add 1 to count. Judge from puzzle with word plus 1.\n\nFor every puzzle from 0 to 5.\nSet count to 0. Judge from puzzle with 0.\n\nFor each entry in counts, show entry.\n","expected":"1\n1\n3\n2\n4\n0\n","step_budget":2000000},{"id":1184,"slug":"distance-between-bus-stops","title":"Distance Between Bus Stops","difficulty":"Easy","category":"Array","code":"The gaps is a list of 1, 2, 3, and 4. The start is 0. The finish is 1. The size is 0. The total is 0.\nFor each gap in gaps.\nAdd 1 to size. Add gap to total.\n\nThe clockwise is 0. The spot is start.\nRepeat while spot is not finish.\nIncrease clockwise by item spot of gaps. Set spot to (spot plus 1) modulo size.\n\nThe other is total minus clockwise. The best is clockwise. If other is less than best, set best to other.\n\nShow best.\n","expected":"1\n","step_budget":2000000},{"id":1185,"slug":"day-of-the-week","title":"Day of the Week","difficulty":"Easy","category":"Math","code":"The day is 31. The month is 8. The year is 2019.\n\nIf month is less than 3.\nIncrease month by 12. Decrease year by 1.\n\nThe century is year divided by 100. The short is year modulo 100. The step is (13 times (month plus 1)) divided by 5. The index is day plus step plus short plus (short divided by 4) plus (century divided by 4) plus (5 times century). Set index to index modulo 7.\n\nThe names is a list of \"Saturday\", \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", and \"Friday\".\n\nShow item index of names.\n","expected":"Saturday\n","step_budget":2000000},{"id":1186,"slug":"maximum-subarray-sum-with-one-deletion","title":"Maximum Subarray Sum with One Deletion","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, -2, 0, and 3. The keep is item 0 of numbers. The skip is item 0 of numbers. The best is item 0 of numbers.\n\nFor every spot from 1 to 3.\nThe value is item spot of numbers. The fresh is keep plus value. If value is more than fresh, set fresh to value. The bent is skip plus value. If keep is more than bent, set bent to keep. Set keep to fresh. Set skip to bent. If keep is more than best, set best to keep. If skip is more than best, set best to skip.\n\nShow best.\n","expected":"4\n","step_budget":2000000},{"id":1187,"slug":"make-array-strictly-increasing","title":"Make Array Strictly Increasing","difficulty":"Hard","category":"Array","code":"Keep a shared firsts holding 1, 5, 3, 6, and 7.\n\nKeep a shared seconds holding 1, 3, 2, and 4.\n\nKeep a shared ways as an empty list of whole numbers.\nFor every spot from 0 to 24.\nPlace 999 into ways.\n\nKeep a shared best of 0.\n\nTo relax from row (a whole number) with option (a whole number). Set best to 999. The value is item row of firsts. If option is more than 0, set value to item (option minus 1) of seconds. The previous is row minus 1.\nFor every prior from 0 to 4.\nThe old is item (previous times 5 plus prior) of ways. The before is item previous of firsts. If prior is more than 0, set before to item (prior minus 1) of seconds. If old is less than best and before is less than value, set best to old.\n\nSet item 0 of ways to 0. Set item 1 of ways to 1. Set item 2 of ways to 1. Set item 3 of ways to 1. Set item 4 of ways to 1.\n\nFor every row from 1 to 4.\nFor every option from 0 to 4.\nRelax from row with option. The cost is best. If option is more than 0, add 1 to cost. Set item (row times 5 plus option) of ways to cost.\n\nThe answer is 999.\nFor every option from 0 to 4.\nIf item (20 plus option) of ways is less than answer, set answer to item (20 plus option) of ways.\n\nIf answer is at least 999, show -1, otherwise show answer.\n","expected":"1\n","step_budget":2000000},{"id":1189,"slug":"maximum-number-of-balloons","title":"Maximum Number of Balloons","difficulty":"Easy","category":"String","code":"The word is \"loonbalxballpoon\". The last is the last position of word. The bees is 0. The ayes is 0. The elles is 0. The ohs is 0. The ens is 0.\n\nFor every spot from 0 to last.\nThe piece is the slice of word from spot to spot plus 1. If piece matches \"b\", add 1 to bees. If piece matches \"a\", add 1 to ayes. If piece matches \"l\", add 1 to elles. If piece matches \"o\", add 1 to ohs. If piece matches \"n\", add 1 to ens.\n\nSet elles to elles divided by 2. Set ohs to ohs divided by 2. The answer is bees. If ayes is less than answer, set answer to ayes. If elles is less than answer, set answer to elles. If ohs is less than answer, set answer to ohs. If ens is less than answer, set answer to ens.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":1190,"slug":"reverse-substrings-between-each-pair-of-parentheses","title":"Reverse Substrings Between Each Pair of Parentheses","difficulty":"Medium","category":"String","code":"Keep a shared stack as an empty list of text. Keep a shared current as empty text. Keep a shared word as empty text. Keep a shared flipped as empty text.\n\nTo turn. Set flipped to empty text. The last is the last position of word.\nFor every step from 0 to last.\nThe source is last minus step. The piece is the slice of word from source to source plus 1. Place piece into flipped.\n\nTo fold. The size is the last position of stack. The opened is item size of stack. remove the last item from stack. Set word to current. Turn. Place flipped into opened. Set current to opened.\n\nThe source is \"(u(love)i)\". The last is the last position of source.\nFor every spot from 0 to last.\nThe piece is the slice of source from spot to spot plus 1. If piece matches \"(\", Place current into stack, set current to empty text. If piece matches \")\", fold. If piece does not match \"(\", If piece does not match \")\", Place piece into current.\n\nShow current.\n","expected":"iloveu\n","step_budget":2000000},{"id":1191,"slug":"k-concatenation-maximum-sum","title":"K-Concatenation Maximum Sum","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1 and 2. The rounds is 3. The total is 0.\nFor each value in numbers.\nAdd value to total.\n\nThe current is 0. The best is 0.\nFor each value in numbers.\nSet current to the larger of current plus value and value. Set best to the larger of best and current.\n\nThe answer is best. If rounds is more than 1 and total is more than 0, set answer to best plus (total times (rounds minus 1)).\n\nShow answer.\n","expected":"9\n","step_budget":2000000},{"id":1192,"slug":"critical-connections-in-a-network","title":"Critical Connections in a Network","difficulty":"Hard","category":"Depth-First Search","code":"Keep a shared adjacency as an empty list of whole numbers. Keep a shared disc as an empty list of whole numbers. Keep a shared low as an empty list of whole numbers. Keep a shared parent as an empty list of whole numbers. Keep a shared bridges as an empty list of whole numbers. Keep a shared timer of 0.\n\nFor every spot from 0 to 15.\nPlace 0 into adjacency.\n\nFor every spot from 0 to 3.\nPlace 0 into disc. Place 0 into low. Place 0 into parent.\n\nTo visit from node (a whole number) with next (a whole number). Set item next of parent to node. Explore from next. The lownext is item next of low. If lownext is less than item node of low, set item node of low to lownext. If lownext is more than item node of disc, Place node into bridges, Place next into bridges.\n\nTo revisit from node (a whole number) with next (a whole number). If next is item node of parent, return. If item next of disc is less than item node of low, set item node of low to item next of disc.\n\nTo explore from node (a whole number). Add 1 to timer. Set item node of disc to timer. Set item node of low to timer.\nFor every next from 0 to 3.\nIf item (node times 4 plus next) of adjacency is 1.\nIf item next of disc is 0, Visit from node with next, otherwise Revisit from node with next.\n\nThe edges is a list of 0, 1, 1, 2, 2, 0, and 1, 3.\nFor every edge from 0 to 3.\nThe origin is item (edge times 2) of edges. The target is item (edge times 2 plus 1) of edges. Set item (origin times 4 plus target) of adjacency to 1. Set item (target times 4 plus origin) of adjacency to 1.\n\nExplore from 0.\n\nThe last is the last position of bridges.\nFor every spot from 0 to last by 2.\nThe line is empty text. The first is item spot of bridges. The second is item (spot plus 1) of bridges. The word is format whole number first as text. Place word into line. Place \",\" into line. The other is format whole number second as text. Place other into line. Show line.\n","expected":"1,3\n","step_budget":2000000},{"id":1200,"slug":"minimum-absolute-difference","title":"Minimum Absolute Difference","difficulty":"Easy","category":"Array","code":"The numbers is a list of 4, 2, 1, and 3. The last is the last position of numbers.\nFor every left from 0 to last.\nFor every right from left to last.\nIf item right of numbers is less than item left of numbers, swap item left of numbers and item right of numbers.\n\nThe best is 1000000.\nFor every spot from 1 to last.\nThe gap is item spot of numbers minus item (spot minus 1) of numbers. If gap is less than best, set best to gap.\n\nFor every spot from 1 to last.\nThe gap is item spot of numbers minus item (spot minus 1) of numbers.\nIf gap is best.\nThe line is empty text. The first is item (spot minus 1) of numbers. The second is item spot of numbers. The word is format whole number first as text. Place word into line. Place \",\" into line. The other is format whole number second as text. Place other into line. Show line.\n","expected":"1,2\n2,3\n3,4\n","step_budget":2000000},{"id":1201,"slug":"ugly-number-iii","title":"Ugly Number III","difficulty":"Medium","category":"Math","code":"Keep a shared firstdiv of 0. Keep a shared seconddiv of 0. Keep a shared thirddiv of 0. Set firstdiv to 2. Set seconddiv to 3. Set thirddiv to 5. Keep a shared divisor of 0. Keep a shared multiple of 0. Keep a shared tally of 0.\n\nTo gcd from first (a whole number) with second (a whole number). If second is 0, set divisor to first, return. Gcd from second with (first modulo second).\n\nTo lcm from first (a whole number) with second (a whole number). Gcd from first with second. Set multiple to (first divided by divisor) times second.\n\nTo count from value (a whole number). Set tally to value divided by firstdiv. Increase tally by (value divided by seconddiv). Increase tally by (value divided by thirddiv). Lcm from firstdiv with seconddiv. The ab is multiple. Lcm from firstdiv with thirddiv. The ac is multiple. Lcm from seconddiv with thirddiv. The bc is multiple. Lcm from ab with thirddiv. The abc is multiple. Decrease tally by (value divided by ab). Decrease tally by (value divided by ac). Decrease tally by (value divided by bc). Increase tally by (value divided by abc).\n\nThe rank is 3. The low is 1. The high is 6.\nRepeat while low is less than high.\nThe middle is (low plus high) divided by 2. Count from middle. If tally is at least rank, set high to middle. If tally is less than rank, set low to middle plus 1.\n\nShow low.\n","expected":"4\n","step_budget":2000000},{"id":1202,"slug":"smallest-string-with-swaps","title":"Smallest String With Swaps","difficulty":"Medium","category":"Array","code":"Keep a shared source as empty text. Place \"dcab\" into source. Keep a shared parent as an empty list of whole numbers. Keep a shared groups as an empty list of text. Keep a shared taken as an empty list of whole numbers. Keep a shared result as empty text. Keep a shared root of 0.\n\nThe size is 4.\nFor every spot from 0 to size minus 1.\nPlace spot into parent. Place \"\" into groups. Place 0 into taken.\n\nTo locate from spot (a whole number). Set root to spot. The cursor is spot.\nRepeat while item cursor of parent is not cursor.\nSet cursor to item cursor of parent. Set root to cursor.\n\nTo gather from spot (a whole number). Locate from spot. The place is root. The piece is the slice of source from spot to spot plus 1. The current is item place of groups. Place piece into current. Set item place of groups to current.\n\nTo pick from spot (a whole number). Locate from spot. The place is root. The start is item place of taken. The upper is start plus 1. The block is item place of groups. The piece is the slice of block from start to upper. Place piece into result. Set item place of taken to upper.\n\nThe pairs is a list of 0, 3, 1, and 2.\nFor every pair from 0 to 1.\nThe one is item (pair times 2) of pairs. The two is item (pair times 2 plus 1) of pairs. Locate from one. The firstroot is root. Locate from two. The secondroot is root. If firstroot is not secondroot, set item firstroot of parent to secondroot.\n\nFor every spot from 0 to size minus 1.\nGather from spot.\n\nFor every spot from 0 to size minus 1.\nThe current is item spot of groups. The ordered is sort characters of current. Set item spot of groups to ordered.\n\nFor every spot from 0 to size minus 1.\nPick from spot.\n\nShow result.\n","expected":"bacd\n","step_budget":2000000},{"id":1203,"slug":"sort-items-by-groups-respecting-dependencies","title":"Sort Items by Groups Respecting Dependencies","difficulty":"Hard","category":"Depth-First Search","code":"Keep a shared group holding -1, -1, 1, 0, 0, 1, 0, and -1.\n\nKeep a shared homes holding 2, 3, 1, 0, 0, 1, 0, and 4.\n\nKeep a shared withins as an empty list of whole numbers. Keep a shared needs as an empty list of whole numbers. Keep a shared taken as an empty list of whole numbers. Keep a shared ranked as an empty list of whole numbers. Keep a shared sizes as an empty list of whole numbers. Keep a shared ordernext as an empty list of whole numbers. Keep a shared orderneed as an empty list of whole numbers. Keep a shared chosen of 0. Keep a shared solos holding 0, 1, and 7.\n\nFor every spot from 0 to 63.\nPlace 0 into withins.\n\nFor every spot from 0 to 7.\nPlace 0 into needs. Place 0 into taken.\n\nFor every spot from 0 to 15.\nPlace 0 into ranked.\n\nFor every spot from 0 to 1.\nPlace 0 into sizes.\n\nFor every spot from 0 to 24.\nPlace 0 into ordernext.\n\nFor every spot from 0 to 4.\nPlace 0 into orderneed.\n\nThe links is a list of 6, 1, 5, 2, 6, 3, 3, 4, 6, and 4.\n\nFor every edge from 0 to 4.\nThe before is item (edge times 2) of links. The after is item (edge times 2 plus 1) of links. The one is item before of group. The two is item after of group. If one is two and one is not -1, set item (before times 8 plus after) of withins to 1, set item after of needs to item after of needs plus 1.\n\nFor every item from 0 to 7.\nThe team is item item of group. If team is not -1, set item team of sizes to item team of sizes plus 1.\n\nTo choose from team (a whole number). Set chosen to -1.\nFor every item from 0 to 7.\nIf item item of group is team and item item of taken is 0 and item item of needs is 0 and chosen is -1, set chosen to item, stop.\n\nTo release from pick (a whole number).\nFor every other from 0 to 7.\nIf item (pick times 8 plus other) of withins is 1, set item other of needs to item other of needs minus 1.\n\nTo arrange from team (a whole number). Set count to 0.\nFor every slot from 0 to 7.\nIf count is less than item team of sizes.\nChoose from team. The pick is chosen.\nIf pick is at least 0.\nSet item (team times 8 plus count) of ranked to pick. Add 1 to count. Set item pick of taken to 1. Release from pick.\n\nTo attach from first (a whole number) with second (a whole number). If item (first times 5 plus second) of ordernext is 1, return. Set item (first times 5 plus second) of ordernext to 1. Increase item second of orderneed by 1.\n\nFor every edge from 0 to 4.\nThe before is item (edge times 2) of links. The after is item (edge times 2 plus 1) of links. The one is item before of homes. The two is item after of homes. If one is not two, Attach from one with two.\n\nArrange from 0. Arrange from 1.\n\nThe queue is an empty list of whole numbers. The order is an empty list of whole numbers. The head is 0. The followed is 0.\nFor every block from 0 to 4.\nIf item block of orderneed is 0, Place block into queue, add 1 to followed.\n\nRepeat while head is less than followed.\nThe node is item head of queue. Add 1 to head. Place node into order.\nFor every next from 0 to 4.\nIf item (node times 5 plus next) of ordernext is 1.\nDecrease item next of orderneed by 1. If item next of orderneed is 0, Place next into queue, add 1 to followed.\n\nTo showgroup from block (a whole number). The count is item block of sizes. The bottom is block times 8.\nFor every within from 0 to count minus 1.\nThe spot is bottom plus within. Show item spot of ranked.\n\nTo showone from block (a whole number). The solo is block minus 2. Show item solo of solos.\n\nTo showblock from block (a whole number). If block is less than 2, Showgroup from block. If block is at least 2, Showone from block.\n\nFor every spot from 0 to 4.\nThe block is item spot of order. Showblock from block.\n","expected":"6\n3\n4\n5\n2\n0\n7\n1\n","step_budget":2000000},{"id":1207,"slug":"unique-number-of-occurrences","title":"Unique Number of Occurrences","difficulty":"Easy","category":"Array","code":"Keep a shared numbers holding 1, 2, 2, 1, 1, and 3.\n\nKeep a shared distinct as an empty list of whole numbers. Keep a shared counts as an empty list of whole numbers. Keep a shared total of 0. Keep a shared known of 0.\n\nTo count from value (a whole number). Set total to 0. The last is the last position of numbers.\nFor every spot from 0 to last.\nIf item spot of numbers is value, add 1 to total.\n\nTo check from value (a whole number). Set known to 0. The last is the last position of distinct.\nFor every spot from 0 to last.\nIf item spot of distinct is value, set known to 1, stop.\n\nFor every spot from 0 to 5.\nThe value is item spot of numbers. Check from value.\nIf known is 0.\nCount from value. Place value into distinct. Place total into counts.\n\nThe same is 0. The last is the last position of counts.\nFor every left from 0 to last.\nFor every right from left plus 1 to last.\nIf item left of counts is item right of counts, set same to 1.\n\nIf same is 0, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1208,"slug":"get-equal-substrings-within-budget","title":"Get Equal Substrings Within Budget","difficulty":"Medium","category":"String","code":"Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared symbol as empty text. Keep a shared position of 0.\n\nTo locate from spot (a whole number). The letter is the slice of alphabet from spot to spot plus 1. If letter matches symbol, set position to spot, return. Locate from spot plus 1.\n\nKeep a shared costs as an empty list of whole numbers. Keep a shared total of 0. Keep a shared left of 0. Keep a shared budget of 0. Keep a shared best of 0. Set budget to 3.\n\nThe first is \"abcd\". The second is \"bcdf\". The last is the last position of first.\nFor every spot from 0 to last.\nThe piece is the slice of first from spot to spot plus 1. Set symbol to piece. Locate from 0. The leftspot is position. The other is the slice of second from spot to spot plus 1. Set symbol to other. Locate from 0. The gap is leftspot minus position. If gap is less than 0, set gap to 0 minus gap. Place gap into costs.\n\nTo shrink from spot (a whole number).\nRepeat while total is more than budget.\nDecrease total by item spot of costs. Add 1 to spot. Set left to spot.\n\nFor every right from 0 to last.\nIncrease total by item right of costs. Shrink from left. The width is right minus left plus 1. If width is more than best, set best to width.\n\nShow best.\n","expected":"3\n","step_budget":2000000},{"id":1209,"slug":"remove-all-adjacent-duplicates-in-string-ii","title":"Remove All Adjacent Duplicates in String II","difficulty":"Medium","category":"String","code":"Keep a shared letters as an empty list of text. Keep a shared counts as an empty list of whole numbers. Keep a shared answer as empty text. Place \"#\" into letters. Place 0 into counts.\n\nTo extend from spot (a whole number). The piece is item spot of letters. The times is item spot of counts.\nFor every copy from 1 to times.\nPlace piece into answer.\n\nThe source is \"deeedbbcccbdaa\". The limit is 3. The last is the last position of source.\n\nFor every spot from 0 to last.\nThe piece is the slice of source from spot to spot plus 1. The size is the last position of letters. The top is item size of letters. The same is 0. If top matches piece, set same to 1. If same is 1, set item size of counts to item size of counts plus 1. If same is 0, Place piece into letters, Place 1 into counts. If same is 1 and item size of counts is limit, remove the last item from letters, remove the last item from counts.\n\nThe last is the last position of letters.\nFor every spot from 1 to last.\nExtend from spot.\n\nShow answer.\n","expected":"aa\n","step_budget":2000000},{"id":1210,"slug":"minimum-moves-to-reach-target-with-rotations","title":"Minimum Moves to Reach Target with Rotations","difficulty":"Hard","category":"Array","code":"Keep a shared grid holding 0, 0, 0, and 0. Keep a shared seen as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared distances as an empty list of whole numbers. Keep a shared last of 1. Keep a shared count of 0.\n\nFor every spot from 0 to 15.\nPlace 0 into seen.\n\nTo enqueue from state (a whole number) with distance (a whole number). If item state of seen is 1, return. Set item state of seen to 1. Place state into queue. Place distance into distances. Add 1 to count.\n\nTo turn from state (a whole number) with distance (a whole number). The headcol is state modulo 2. The rest is state divided by 2. The headrow is rest modulo 2. The rest is rest divided by 2. The tailcol is rest modulo 2. The tailrow is rest divided by 2. The horizontal is 0. If tailrow is headrow and headcol is tailcol plus 1, set horizontal to 1.\nIf horizontal is 1 and headrow is less than last.\nThe cell is item (headrow times 2 plus headcol plus 2) of grid. The fresh is ((headrow times 2 plus headcol) times 2 plus headrow plus 1) times 2 plus headcol. If cell is 0, Enqueue from fresh with distance plus 1.\n\nTo bend from state (a whole number) with distance (a whole number). The headcol is state modulo 2. The rest is state divided by 2. The headrow is rest modulo 2. The rest is rest divided by 2. The tailcol is rest modulo 2. The tailrow is rest divided by 2. The vertical is 0. If tailcol is headcol and headrow is tailrow plus 1, set vertical to 1.\nIf vertical is 1 and headcol is more than 0.\nThe cell is item (headrow times 2 plus headcol minus 1) of grid. The fresh is ((headrow times 2 plus headcol) times 2 plus headrow) times 2 plus headcol minus 1. If cell is 0, Enqueue from fresh with distance plus 1.\n\nTo advance from state (a whole number) with distance (a whole number). The headcol is state modulo 2. The rest is state divided by 2. The headrow is rest modulo 2. The rest is rest divided by 2. The tailcol is rest modulo 2. The tailrow is rest divided by 2. The horizontal is 0. If tailrow is headrow and headcol is tailcol plus 1, set horizontal to 1.\nIf horizontal is 1 and headcol is less than last.\nThe cell is item (headrow times 2 plus headcol plus 1) of grid. The fresh is ((tailrow times 2 plus tailcol plus 1) times 2 plus headrow) times 2 plus headcol plus 1. If cell is 0, Enqueue from fresh with distance plus 1.\n\nTo descend from state (a whole number) with distance (a whole number). The headcol is state modulo 2. The rest is state divided by 2. The headrow is rest modulo 2. The rest is rest divided by 2. The tailcol is rest modulo 2. The tailrow is rest divided by 2. The vertical is 0. If tailcol is headcol and headrow is tailrow plus 1, set vertical to 1.\nIf vertical is 1 and headrow is less than last.\nThe cell is item (headrow times 2 plus headcol plus 2) of grid. The fresh is ((tailrow times 2 plus tailcol plus 2) times 2 plus headrow plus 1) times 2 plus headcol. If cell is 0, Enqueue from fresh with distance plus 1.\n\nSet item 1 of seen to 1. Place 1 into queue. Place 0 into distances. Set count to 1. The head is 0. The answer is -1.\n\nRepeat while head is less than count.\nThe state is item head of queue. The travel is item head of distances. Add 1 to head. If state is 11 or state is 14, set answer to travel, stop. Turn from state with travel. Bend from state with travel. Advance from state with travel. Descend from state with travel.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":1217,"slug":"minimum-cost-to-move-chips-to-the-same-position","title":"Minimum Cost to Move Chips to The Same Position","difficulty":"Easy","category":"Array","code":"The positions is a list of 1, 2, and 3. The evens is 0. The odds is 0.\nFor each value in positions.\nIf value modulo 2 is 0, add 1 to evens, otherwise add 1 to odds.\n\nIf evens is less than odds, show evens, otherwise show odds.\n","expected":"1\n","step_budget":2000000},{"id":1218,"slug":"longest-arithmetic-subsequence-of-given-difference","title":"Longest Arithmetic Subsequence of Given Difference","difficulty":"Medium","category":"Array","code":"The readings is a list of 1, 5, 7, 8, 5, 3, 4, 2, and 1. The step is -2. The lengths is a list of 9 zeros.\nFor every finish from 0 to 8.\nSet item finish of lengths to 1.\nFor every prior from 0 to finish minus 1.\nIf item prior of readings plus step is item finish of readings and item prior of lengths plus 1 is more than item finish of lengths, set item finish of lengths to item prior of lengths plus 1.\n\nThe longest is 1.\nFor every finish from 0 to 8.\nIf item finish of lengths is more than longest, set longest to item finish of lengths.\n\nShow longest.\n","expected":"4\n","step_budget":2000000},{"id":1219,"slug":"path-with-maximum-gold","title":"Path with Maximum Gold","difficulty":"Medium","category":"Array","code":"Keep a shared gold holding 0, 6, 0, 5, 8, 7, 0, 9, and 0. Keep a shared best of 0. Keep a shared width of 3. Keep a shared height of 3.\n\nTo Explore from cell (a whole number) with total (a whole number). The here is item cell of gold. If here is 0, return. The band is cell divided by width. The col is cell modulo width. Set item cell of gold to 0. The gained is total plus here. If gained is more than best, set best to gained.\nIf cell is at least width and item (cell minus width) of gold is more than 0, Explore from cell minus width with gained. If cell is less than height times width minus width and item (cell plus width) of gold is more than 0, Explore from cell plus width with gained. If col is more than 0 and item (cell minus 1) of gold is more than 0, Explore from cell minus 1 with gained. If col is less than width minus 1 and item (cell plus 1) of gold is more than 0, Explore from cell plus 1 with gained. Set item cell of gold to here.\n\nFor every cell from 0 to 8.\nExplore from cell with 0.\n\nShow best.\n","expected":"24\n","step_budget":2000000},{"id":1220,"slug":"count-vowels-permutation","title":"Count Vowels Permutation","difficulty":"Hard","category":"Dynamic Programming","code":"The count is 5. The alpha is 1. The echo is 1. The india is 1. The oscar is 1. The uniform is 1. The round is 2.\nRepeat while round is at most count.\nThe nextalpha is echo plus india plus uniform. The nextecho is alpha plus india. The nextindia is echo plus oscar. The nextoscar is india. The nextuniform is india plus oscar. Set alpha to nextalpha. Set echo to nextecho. Set india to nextindia. Set oscar to nextoscar. Set uniform to nextuniform. Add 1 to round.\n\nThe total is alpha plus echo plus india plus oscar plus uniform. Show total modulo 1000000007.\n","expected":"68\n","step_budget":2000000},{"id":1221,"slug":"split-a-string-in-balanced-strings","title":"Split a String in Balanced Strings","difficulty":"Easy","category":"String","code":"The symbols is \"RLRRLLRLRL\". The balance is 0. The pieces is 0.\nFor every spot from 0 to the last position of symbols.\nThe symbol is character spot of symbols. If symbol is \"R\", add 1 to balance, otherwise subtract 1 from balance. If balance is 0, add 1 to pieces.\n\nShow pieces.\n","expected":"4\n","step_budget":2000000},{"id":1222,"slug":"queens-that-can-attack-the-king","title":"Queens That Can Attack the King","difficulty":"Medium","category":"Array","code":"The queenrows is a list of 0, 1, 4, 0, 3, and 2. The queencols is a list of 1, 0, 0, 4, 3, and 4. The kingrow is 0. The kingcol is 0. The nearest is a list of 9 zeros. The pickrow is a list of 9 zeros. The pickcol is a list of 9 zeros.\nFor every spot from 0 to 5.\nThe queenrow is item spot of queenrows. The queencol is item spot of queencols. The down is queenrow minus kingrow. The across is queencol minus kingcol. The aligned is 0. If down is 0 or across is 0 or the absolute value of down is the absolute value of across, set aligned to 1.\nIf aligned is 1.\nThe stepdown is 0. If down is less than 0, set stepdown to -1. If down is more than 0, set stepdown to 1. The stepacross is 0. If across is less than 0, set stepacross to -1. If across is more than 0, set stepacross to 1. The slot is (stepdown plus 1) times 3 plus stepacross plus 1. The distance is the absolute value of down plus the absolute value of across. The better is 0. If item slot of nearest is 0, set better to 1. If distance is less than item slot of nearest, set better to 1. If better is 1 and distance is more than 0, set item slot of nearest to distance, set item slot of pickrow to queenrow, set item slot of pickcol to queencol.\n\nThe board is a list of 64 zeros.\nFor every slot from 0 to 8.\nIf item slot of nearest is more than 0, set item (item slot of pickrow times 8 plus item slot of pickcol) of board to 1.\n\nThe rows is an empty list of whole numbers. The cols is an empty list of whole numbers.\nFor every depth from 0 to 7.\nFor every column from 0 to 7.\nIf item (depth times 8 plus column) of board is 1, Place depth into rows, Place column into cols.\n\nThe line is empty text. Place \"[\" into line.\nFor every spot from 0 to the last position of rows.\nIf spot is more than 0, Place \",\" into line. The rowtext is format whole number item spot of rows as text. The coltext is format whole number item spot of cols as text. Place \"[\" into line. Place rowtext into line. Place \",\" into line. Place coltext into line. Place \"]\" into line.\n\nPlace \"]\" into line. Show line.\n","expected":"[[0,1],[1,0],[3,3]]\n","step_budget":2000000},{"id":1223,"slug":"dice-roll-simulation","title":"Dice Roll Simulation","difficulty":"Hard","category":"Array","code":"The count is 3. The limits is a list of 1, 1, 1, 2, 2, and 3. The width is 16. The stride is 96. The table is a list of 384 zeros.\nFor every face from 0 to 5.\nSet item (stride plus face times width plus 1) of table to 1.\n\nFor every round from 2 to count.\nFor every face from 0 to 5.\nFor every run from 1 to width minus 1.\nFor every target from 0 to 5.\nThe ways is item ((round minus 1) times stride plus face times width plus run) of table. The other is round times stride plus target times width plus 1. If target is not face and ways is more than 0, set item other of table to item other of table plus ways. If target is face and run is less than item target of limits and ways is more than 0, set item (other plus run) of table to item (other plus run) of table plus ways.\n\nThe total is 0.\nFor every face from 0 to 5.\nFor every run from 1 to width minus 1.\nThe portion is item (count times stride plus face times width plus run) of table. Add portion to total.\n\nShow total.\n","expected":"181\n","step_budget":2000000},{"id":1224,"slug":"maximum-equal-frequency","title":"Maximum Equal Frequency","difficulty":"Hard","category":"Array","code":"The numbers is a list of 2, 2, 1, 1, 5, 3, 3, and 5. Keep a shared seen as an empty list of whole numbers. Keep a shared counts as an empty list of whole numbers. Keep a shared incoming of 0. Keep a shared position of 0. Keep a shared high of 0. Keep a shared highcount of 0. Keep a shared singles of 0. Keep a shared distinct of 0. Keep a shared best of 0.\n\nTo Seek from spot (a whole number). If spot is more than the last position of seen, set position to -1, return. If item spot of seen is incoming, set position to spot, return. Seek from spot plus 1.\n\nTo Survey from spot (a whole number). If spot is more than the last position of counts, return. The tally is item spot of counts. If tally is more than high, set high to tally. If tally is 1, add 1 to singles. Survey from spot plus 1.\n\nTo Count from spot (a whole number). If spot is more than the last position of counts, return. If item spot of counts is high, add 1 to highcount. Count from spot plus 1.\n\nTo Size from spot (a whole number). If spot is more than the last position of counts, return. Add 1 to distinct. Size from spot plus 1.\n\nThe length is 0.\nFor every spot from 0 to 7.\nAdd 1 to length. Set incoming to item spot of numbers. Seek from 0. The slot is position. If slot is less than 0, Place incoming into seen, Place 1 into counts. If slot is at least 0, set item slot of counts to item slot of counts plus 1. Set high to 0. Set highcount to 0. Set singles to 0. Set distinct to 0. Survey from 0. Count from 0. Size from 0. The without is length minus 1. The flattened is distinct times (high minus 1). The trimmed is (distinct minus 1) times high. The okay is 0. If high is 1, set okay to 1. If highcount is 1 and without is flattened, set okay to 1. If singles is 1 and without is trimmed, set okay to 1. If okay is 1, set best to length.\n\nShow best.\n","expected":"7\n","step_budget":2000000},{"id":1227,"slug":"airplane-seat-assignment-probability","title":"Airplane Seat Assignment Probability","difficulty":"Medium","category":"Math","code":"The seats is 2. If seats is 1, show \"1.00000\", otherwise show \"0.50000\".\n","expected":"0.50000\n","step_budget":2000000},{"id":1232,"slug":"check-if-it-is-a-straight-line","title":"Check If It Is a Straight Line","difficulty":"Easy","category":"Array","code":"The points is a list of 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 7, and 7. The firstx is item 0 of points. The firsty is item 1 of points. The secondx is item 2 of points. The secondy is item 3 of points. The valid is 1.\nFor every spot from 1 to 5.\nThe herex is item (spot times 2) of points. The herey is item (spot times 2 plus 1) of points. The along is (herex minus firstx) times (secondy minus firsty) minus (herey minus firsty) times (secondx minus firstx). If along is not 0, set valid to 0, stop.\n\nIf valid is 1, show true, otherwise show false.\n","expected":"false\n","step_budget":2000000},{"id":1233,"slug":"remove-sub-folders-from-the-filesystem","title":"Remove Sub-Folders from the Filesystem","difficulty":"Medium","category":"Array","code":"The folders is a list of \"/a\", \"/a/b\", \"/c/d\", \"/c/d/e\", and \"/c/f\". The removed is a list of 5 zeros.\nFor every left from 0 to the last position of folders.\nFor every right from 0 to the last position of folders.\nThe parent is item left of folders. The current is item right of folders. The parentsize is the length of parent. The currentsize is the length of current.\nIf parentsize is less than currentsize.\nThe same is 1.\nFor every index from 0 to parentsize minus 1.\nThe first is character index of current. The second is character index of parent. If first is not second, set same to 0.\nIf index is parentsize minus 1 and same is 1.\nThe edge is character parentsize of current. If edge is \"/\", set item right of removed to 1.\n\nThe kept is an empty list of text.\nFor every spot from 0 to the last position of folders.\nIf item spot of removed is 0, Place item spot of folders into kept.\n\nThe line is empty text. Place \"[\" into line.\nFor every spot from 0 to the last position of kept.\nIf spot is more than 0, Place \",\" into line. Place \"\\\"\" into line. Place item spot of kept into line. Place \"\\\"\" into line.\n\nPlace \"]\" into line. Show line.\n","expected":"[\"/a\",\"/c/d\",\"/c/f\"]\n","step_budget":2000000},{"id":1234,"slug":"replace-the-substring-for-balanced-string","title":"Replace the Substring for Balanced String","difficulty":"Medium","category":"String","code":"The text is \"QQQW\". Keep a shared total holding 0, 0, 0, and 0. Keep a shared window holding 0, 0, 0, and 0. Keep a shared target of 0. Keep a shared fit of 0.\n\nTo Check. Set fit to 1.\nFor every kind from 0 to 3.\nThe outside is item kind of total minus item kind of window. If outside is more than target, set fit to 0.\n\nThe size is 0.\nFor every spot from 0 to the last position of text.\nAdd 1 to size.\n\nSet target to size divided by 4.\nFor every spot from 0 to the last position of text.\nThe symbol is character spot of text. The kind is 0. If symbol is \"W\", set kind to 1. If symbol is \"E\", set kind to 2. If symbol is \"R\", set kind to 3. Increase item kind of total by 1.\n\nThe best is size. The left is 0. The right is 0. Check. If fit is 1, set best to 0.\nRepeat while right is less than size.\nAdd 1 to right. The at is right minus 1. The symbol is character at of text. The kind is 0. If symbol is \"W\", set kind to 1. If symbol is \"E\", set kind to 2. If symbol is \"R\", set kind to 3. Increase item kind of window by 1. Check.\nRepeat while fit is 1 and left is less than right.\nThe span is right minus left. If span is less than best, set best to span. The old is character left of text. The oldkind is 0. If old is \"W\", set oldkind to 1. If old is \"E\", set oldkind to 2. If old is \"R\", set oldkind to 3. Decrease item oldkind of window by 1. Add 1 to left. Check.\n\nShow best.\n","expected":"2\n","step_budget":2000000},{"id":1235,"slug":"maximum-profit-in-job-scheduling","title":"Maximum Profit in Job Scheduling","difficulty":"Hard","category":"Array","code":"Keep a shared begins holding 1, 2, 3, and 3. Keep a shared ends holding 3, 4, 5, and 6. Keep a shared gains holding 50, 10, 40, and 70. Keep a shared best of 0. Keep a shared ready of 0.\n\nTo Walk from spot (a whole number) with total (a whole number). If spot is more than the last position of begins and total is more than best, set best to total. If spot is more than the last position of begins, return. Walk from spot plus 1 with total. If item spot of begins is at least ready, Improve from spot with total.\n\nTo Improve from spot (a whole number) with total (a whole number). The finish is item spot of ends. The gained is total plus item spot of gains. The old is ready. Set ready to finish. Walk from spot plus 1 with gained. Set ready to old.\n\nSet ready to 0. Walk from 0 with 0. Show best.\n","expected":"120\n","step_budget":2000000},{"id":1238,"slug":"circular-permutation-in-binary-representation","title":"Circular Permutation in Binary Representation","difficulty":"Medium","category":"Math","code":"The width is 2. The start is 3. The amount is 1.\nFor every step from 1 to width.\nSet amount to amount times 2.\n\nThe line is empty text. Place \"[\" into line.\nFor every spot from 0 to amount minus 1.\nThe shifted is shift spot right by 1. The mixed is exclusive or of spot and shifted. The value is exclusive or of mixed and start. If spot is more than 0, Place \",\" into line. The piece is format whole number value as text. Place piece into line.\n\nPlace \"]\" into line. Show line.\n","expected":"[3,2,0,1]\n","step_budget":2000000},{"id":1239,"slug":"maximum-length-of-a-concatenated-string-with-unique-characters","title":"Maximum Length of a Concatenated String with Unique Characters","difficulty":"Medium","category":"Array","code":"Keep a shared words holding \"un\", \"iq\", and \"ue\". Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared letter of 0. Keep a shared found of 0. Keep a shared masks as an empty list of whole numbers. Keep a shared usable as an empty list of whole numbers. Place 0 into masks. Place 0 into masks. Place 0 into masks. Place 0 into usable. Place 0 into usable. Place 0 into usable. Keep a shared chosen of 0. Keep a shared best of 0.\n\nTo Locate from index (a whole number). If index is more than 25, set found to -1, return. The symbol is character index of alphabet. If symbol is letter, set found to index, return. Locate from index plus 1.\n\nTo Weigh from bit (a whole number) with total (a whole number). If bit is more than 25 and total is more than best, set best to total. If bit is more than 25, return. The place is shift 1 left by bit. The overlap is bitwise and of chosen and place. If overlap is more than 0, Weigh from bit plus 1 with total plus 1. If overlap is 0, Weigh from bit plus 1 with total.\n\nTo Finish with picked (a whole number). Set chosen to picked. Weigh from 0 with 0.\n\nTo Take from spot (a whole number) with picked (a whole number). The mixed is exclusive or of picked and item spot of masks. Gather from spot plus 1 with mixed.\n\nTo Try from spot (a whole number) with picked (a whole number). The overlap is bitwise and of picked and item spot of masks. If overlap is 0, Take from spot with picked.\n\nTo Gather from spot (a whole number) with picked (a whole number). If spot is more than the last position of words, Finish with picked, return. Gather from spot plus 1 with picked. If item spot of usable is 1, Try from spot with picked.\n\nFor every spot from 0 to 2.\nSet item spot of masks to 0. Set item spot of usable to 1. The word is item spot of words.\nFor every index from 0 to the last position of word.\nSet letter to character index of word. Locate from 0. The bit is shift 1 left by found. The overlap is bitwise and of item spot of masks and bit. If overlap is more than 0, set item spot of usable to 0, stop. Increase item spot of masks by bit.\n\nGather from 0 with 0. Show best.\n","expected":"4\n","step_budget":2000000},{"id":1240,"slug":"tiling-a-rectangle-with-the-fewest-squares","title":"Tiling a Rectangle with the Fewest Squares","difficulty":"Hard","category":"Backtracking","code":"Keep a shared best of 99. Keep a shared open of 0. Keep a shared masks holding 27, 54, 1, 2, 4, 8, 16, and 32.\n\nTo Find from spot (a whole number) with taken (a whole number). If spot is more than 5, set open to -1, return. The bit is shift 1 left by spot. The overlap is bitwise and of taken and bit. If overlap is 0, set open to spot, return. Find from spot plus 1 with taken.\n\nTo Cover from filled (a whole number) with used (a whole number). If used is at least best, return. If filled is 63 and used is less than best, set best to used. If filled is 63, return. Find from 0 with filled.\nFor every place from 0 to 7.\nThe square is item place of masks. The bit is shift 1 left by open. The covers is bitwise and of square and bit. The hits is bitwise and of filled and square. If covers is more than 0 and hits is 0, Cover from filled plus square with used plus 1.\n\nCover from 0 with 0. Show best.\n","expected":"3\n","step_budget":2000000},{"id":1247,"slug":"minimum-swaps-to-make-strings-equal","title":"Minimum Swaps to Make Strings Equal","difficulty":"Medium","category":"String","code":"The first is \"xx\". The second is \"yy\". The leftovers is 0. The rightovers is 0.\nFor every spot from 0 to the last position of first.\nThe left is character spot of first. The right is character spot of second. If left is \"x\" and right is \"y\", add 1 to leftovers. If left is \"y\" and right is \"x\", add 1 to rightovers.\n\nThe mismatch is leftovers plus rightovers. If mismatch modulo 2 is 1, show -1.\nIf mismatch modulo 2 is 0.\nThe swaps is leftovers divided by 2 plus rightovers divided by 2 plus (leftovers modulo 2) times 2. Show swaps.\n","expected":"1\n","step_budget":2000000},{"id":1248,"slug":"count-number-of-nice-subarrays","title":"Count Number of Nice Subarrays","difficulty":"Medium","category":"Array","code":"The readings is a list of 1, 1, 2, 1, and 1. The wanted is 3. The seen is a list of 6 zeros. Set item 0 of seen to 1. The odds is 0. The ways is 0.\nFor each value in readings.\nIf value modulo 2 is 1, add 1 to odds. If odds is at least wanted, The prior is item (odds minus wanted) of seen, Set ways to ways plus prior. Increase item odds of seen by 1.\n\nShow ways.\n","expected":"2\n","step_budget":2000000},{"id":1249,"slug":"minimum-remove-to-make-valid-parentheses","title":"Minimum Remove to Make Valid Parentheses","difficulty":"Medium","category":"String","code":"The text is \"lee(t(c)o)de)\". The keeps is a list of 13 zeros. The stack is an empty list of whole numbers.\nFor every spot from 0 to 12.\nSet item spot of keeps to 1. The symbol is character spot of text. The depth is the number of items in stack. If symbol is \"(\", Place spot into stack. If symbol is \")\" and depth is more than 0, remove the last item from stack. If symbol is \")\" and depth is 0, set item spot of keeps to 0.\n\nFor every spot from 0 to the last position of stack.\nSet item (item spot of stack) of keeps to 0.\n\nThe letters is an empty list of text.\nFor every spot from 0 to 12.\nThe piece is the slice of text from spot to spot plus 1. If item spot of keeps is 1, Place piece into letters.\n\nThe result is join letters with \"\". Show result.\n","expected":"lee(t(c)o)de\n","step_budget":2000000},{"id":1250,"slug":"check-if-it-is-a-good-array","title":"Check If It Is a Good Array","difficulty":"Hard","category":"Array","code":"The values is a list of 12, 5, 7, and 23. Keep a shared common of 0.\n\nTo Reduce from first (a whole number) with second (a whole number). The low is the absolute value of first. The high is the absolute value of second. If high is 0, set common to low, return. Reduce from high with low modulo high.\n\nSet common to item 0 of values.\nFor every spot from 1 to 3.\nIf common is 1, stop. Reduce from common with item spot of values.\n\nIf common is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1252,"slug":"cells-with-odd-values-in-a-matrix","title":"Cells with Odd Values in a Matrix","difficulty":"Easy","category":"Array","code":"The rows is 2, while the columns is 3. The pairs is a list of 0, 1, 1, and 1. The size is rows times columns. The cells is a list of size zeros.\nFor every which from 0 to 1.\nThe rowspot is item (which times 2) of pairs. The colspot is item (which times 2 plus 1) of pairs.\nFor every column from 0 to columns minus 1.\nIncrease item (rowspot times columns plus column) of cells by 1.\nFor every band from 0 to rows minus 1.\nIncrease item (band times columns plus colspot) of cells by 1.\n\nThe odds is 0.\nFor each value in cells.\nIf value modulo 2 is 1, add 1 to odds.\n\nShow odds.\n","expected":"6\n","step_budget":2000000},{"id":1253,"slug":"reconstruct-a-2-row-binary-matrix","title":"Reconstruct a 2-Row Binary Matrix","difficulty":"Medium","category":"Array","code":"The upper is 2, while the lower is 1. The sums is a list of 1, 1, and 1. The tops is an empty list of whole numbers. The bottoms is an empty list of whole numbers.\nFor each amount in sums.\nIf amount is 2, Place 1 into tops, Place 1 into bottoms.\nIf amount is 1.\nIf upper is more than 0, Place 1 into tops, Place 0 into bottoms, subtract 1 from upper, otherwise Place 0 into tops, Place 1 into bottoms, subtract 1 from lower.\n\nThe topline is empty text. The bottomline is empty text.\nFor every spot from 0 to the last position of tops.\nIf spot is more than 0, Place \",\" into topline. Place format whole number item spot of tops as text into topline. If spot is more than 0, Place \",\" into bottomline. Place format whole number item spot of bottoms as text into bottomline.\n\nShow topline. Show bottomline.\n","expected":"1,1,0\n0,0,1\n","step_budget":2000000},{"id":1254,"slug":"number-of-closed-islands","title":"Number of Closed Islands","difficulty":"Medium","category":"Array","code":"Keep a shared cells holding 1, 1, 1, 1, 0, 1, 1, 1, and 1. Keep a shared visited as a list of 9 zeros. Keep a shared islands of 0. Keep a shared levels of 0. Keep a shared spans of 0. Set levels to 3. Set spans to 3.\n\nTo sink from node (a whole number). If node is less than 0, return. If node is at least 9, return. If item node of cells is not 0, return. If item node of visited is 1, return. Set item node of visited to 1. The band is node divided by spans. The file is node modulo spans. If band is more than 0, sink from node minus spans. If band is less than levels minus 1, sink from node plus spans. If file is more than 0, sink from node minus 1. If file is less than spans minus 1, sink from node plus 1.\n\nTo probe from node (a whole number). If node is less than 0, return. If node is at least 9, return. If item node of cells is not 0, return. If item node of visited is 1, return. Set item node of visited to 1. The band is node divided by spans. The file is node modulo spans. If band is more than 0, probe from node minus spans. If band is less than levels minus 1, probe from node plus spans. If file is more than 0, probe from node minus 1. If file is less than spans minus 1, probe from node plus 1.\n\nFor every node from 0 to 8.\nThe band is node divided by spans. The file is node modulo spans. If band is 0 and item node of cells is 0, sink from node. If band is levels minus 1 and item node of cells is 0, sink from node. If file is 0 and item node of cells is 0, sink from node. If file is spans minus 1 and item node of cells is 0, sink from node.\n\nFor every node from 0 to 8.\nIf item node of cells is 0 and item node of visited is 0, probe from node, add 1 to islands.\n\nShow islands.\n","expected":"1\n","step_budget":2000000},{"id":1255,"slug":"maximum-score-words-formed-by-letters","title":"Maximum Score Words Formed by Letters","difficulty":"Hard","category":"Array","code":"Keep a shared needed as a list of 26 zeros. Keep a shared available holding 2, 0, 1, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, and 0. Keep a shared wordcounts holding 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, and 0. Keep a shared wordscores holding 8, 10, 11, and 8. Keep a shared weights holding 1, 2, 4, and 8. Keep a shared total of 0. Keep a shared best of 0. Keep a shared fit of 1.\nTo reset from letter (a whole number). If letter is more than 25, return. Set item letter of needed to 0. Reset from letter plus 1.\n\nTo addcounts from letter (a whole number) with base (a whole number). If letter is more than 25, return. Increase item letter of needed by item (base plus letter) of wordcounts. Addcounts from letter plus 1 with base.\n\nTo include from word (a whole number). The base is word times 26. Addcounts from 0 with base. Increase total by item word of wordscores.\n\nTo measure from mask (a whole number) with word (a whole number). If word is more than 3, return. The bit is bitwise and of mask and item word of weights. If bit is not 0, include from word. Measure from mask with word plus 1.\n\nTo inspect from letter (a whole number). If letter is more than 25 and fit is 1 and total is more than best, set best to total. If letter is more than 25, return. If item letter of needed is more than item letter of available, set fit to 0. Inspect from letter plus 1.\n\nFor every mask from 0 to 15.\nSet total to 0. Set fit to 1. Reset from 0. Measure from mask with 0. Inspect from 0.\n\nShow best.\n","expected":"19\n","step_budget":2000000},{"id":1260,"slug":"shift-2d-grid","title":"Shift 2D Grid","difficulty":"Easy","category":"Array","code":"The grid is a list of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The rows is 3, while the columns is 3. The steps is 1. The total is rows times columns. The turn is steps modulo total. The flat is an empty list of whole numbers. For each value in grid, Place value into flat. The moved is a list of total zeros.\nFor every spot from 0 to total minus 1.\nThe target is (spot plus turn) modulo total. Set item target of moved to item spot of flat.\n\nFor each value in moved, show value.\n","expected":"9\n1\n2\n3\n4\n5\n6\n7\n8\n","step_budget":2000000},{"id":1262,"slug":"greatest-sum-divisible-by-three","title":"Greatest Sum Divisible by Three","difficulty":"Medium","category":"Array","code":"Keep a shared table holding 0, -1000000, and -1000000. Keep a shared fresh as a list of 3 zeros. The values is a list of 3, 6, 5, 1, and 8.\n\nTo settle from value (a whole number). The leftover is value modulo 3.\nFor every rest from 0 to 2.\nThe before is (rest minus leftover plus 3) modulo 3. The candidate is item rest of table. If item before of table is more than -1000000, set candidate to the larger of candidate and item before of table plus value. Set item rest of fresh to candidate.\n\nTo replace.\nFor every rest from 0 to 2.\nSet item rest of table to item rest of fresh.\n\nFor each value in values.\nSettle from value. Replace.\n\nShow item 0 of table.\n","expected":"18\n","step_budget":2000000},{"id":1263,"slug":"minimum-moves-to-move-a-box-to-their-target-location","title":"Minimum Moves to Move a Box to Their Target Location","difficulty":"Hard","category":"Array","code":"Keep a shared grid holding 1, 1, 1, 1, 1, 1, 0, 0, 4, 1, 1, 0, 0, 0, 1, 1, 0, 2, 0, 1, 1, 0, 3, 0, and 1. Keep a shared seen as an empty list of whole numbers. Keep a shared distance as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers.\nFor every state from 0 to 624.\nPlace 0 into seen. Place 0 into distance. Place 0 into queue.\n\nKeep a shared count of 0.\n\nTo expand from state (a whole number) with offset (a whole number).\nThe boxcell is state divided by 25. The playercell is state modulo 25. The nextcell is playercell plus offset.\nIf item nextcell of grid is 1, return.\nIf nextcell is boxcell and item (boxcell plus offset) of grid is 1, return.\nThe newboxcell is boxcell. The newplayercell is nextcell.\nIf nextcell is boxcell, set newboxcell to boxcell plus offset, set newplayercell to boxcell.\nThe freshstate is newboxcell times 25 plus newplayercell.\nIf item freshstate of seen is 1, return.\nSet item freshstate of seen to 1. Set item freshstate of distance to item state of distance plus 1. The slot is count. Set item slot of queue to freshstate. Add 1 to count.\n\nThe start is 447. Set item 447 of seen to 1. Set item 0 of queue to start. Set count to 1. The head is 0. The answer is -1.\nRepeat while head is less than count and answer is less than 0.\nThe state is item head of queue. Add 1 to head. The boxcell is state divided by 25. If boxcell is 8, set answer to item state of distance.\nIf boxcell is not 8.\nThe playercell is state modulo 25. The band is playercell divided by 5. The file is playercell modulo 5. If band is more than 0, Expand from state with -5. If band is less than 4, Expand from state with 5. If file is more than 0, Expand from state with -1. If file is less than 4, Expand from state with 1.\n\nShow answer.\n","expected":"5\n","step_budget":2000000},{"id":1266,"slug":"minimum-time-visiting-all-points","title":"Minimum Time Visiting All Points","difficulty":"Easy","category":"Array","code":"The xs is a list of 1, 3, and -1. The ys is a list of 1, 4, and 0. The last is the last position of xs. The total is 0.\nFor every spot from 1 to last.\nThe east is item spot of xs minus item (spot minus 1) of xs. The north is item spot of ys minus item (spot minus 1) of ys. Set east to the absolute value of east. Set north to the absolute value of north. The stride is the larger of east and north. Add stride to total.\n\nShow total.\n","expected":"7\n","step_budget":2000000},{"id":1267,"slug":"count-servers-that-communicate","title":"Count Servers that Communicate","difficulty":"Medium","category":"Array","code":"The grid is a list of 1, 0, 1, and 1. The rows is 2, while the columns is 2. The rowtotals is a list of 2 zeros. The coltotals is a list of 2 zeros.\nFor every row from 0 to 1.\nFor every column from 0 to 1.\nIf item (row times columns plus column) of grid is 1, set item row of rowtotals to item row of rowtotals plus 1, set item column of coltotals to item column of coltotals plus 1.\n\nThe linked is 0.\nFor every row from 0 to 1.\nFor every column from 0 to 1.\nIf item (row times columns plus column) of grid is 1 and item row of rowtotals is more than 1, add 1 to linked. If item (row times columns plus column) of grid is 1 and item row of rowtotals is 1 and item column of coltotals is more than 1, add 1 to linked.\n\nShow linked.\n","expected":"3\n","step_budget":2000000},{"id":1268,"slug":"search-suggestions-system","title":"Search Suggestions System","difficulty":"Medium","category":"Array","code":"Keep a shared wordslist holding \"mobile\", \"moneypot\", \"monitor\", \"mouse\", and \"mousepad\".\nFor every left from 0 to 4.\nFor every right from left plus 1 to 4.\nIf item right of wordslist comes before item left of wordslist, swap item left of wordslist and item right of wordslist.\n\nKeep a shared pickscount of 0. Keep a shared opening as empty text. Keep a shared line as empty text. Keep a shared same of 0.\n\nTo match from index (a whole number). Set same to 1. The word is item index of wordslist. The span is the length of opening.\nFor every part from 0 to span minus 1.\nIf character part of word is not character part of opening, set same to 0.\n\nTo collect. Set line to empty text. Set pickscount to 0.\nFor every index from 0 to the last position of wordslist.\nThe word is item index of wordslist.\nIf pickscount is less than 3.\nIf the length of word is at least the length of opening.\nMatch from index.\nIf same is 1.\nIf pickscount is more than 0, Place \",\" into line. Place word into line. Add 1 to pickscount.\n\nThe sought is \"mouse\".\nFor every spot from 0 to the last position of sought.\nThe piece is the slice of sought from spot to spot plus 1. Place piece into opening. Collect. Show line.\n","expected":"mobile,moneypot,monitor\nmobile,moneypot,monitor\nmouse,mousepad\nmouse,mousepad\nmouse,mousepad\n","step_budget":2000000},{"id":1269,"slug":"number-of-ways-to-stay-in-the-same-place-after-some-steps","title":"Number of Ways to Stay in the Same Place After Some Steps","difficulty":"Hard","category":"Dynamic Programming","code":"The steps is 3, while the places is 2. The reach is the smaller of steps plus 1 and places. The width is reach plus 2. The table is a list of width zeros. The fresh is a list of width zeros. Set item 1 of table to 1.\nFor every stride from 1 to steps.\nFor every spot from 1 to reach.\nIf stride modulo 2 is 1, set item spot of fresh to (item spot of table plus item (spot minus 1) of table plus item (spot plus 1) of table) modulo 1000000007. If stride modulo 2 is 0, set item spot of table to (item spot of fresh plus item (spot minus 1) of fresh plus item (spot plus 1) of fresh) modulo 1000000007.\n\nIf steps modulo 2 is 1, show item 1 of fresh, otherwise show item 1 of table.\n","expected":"4\n","step_budget":2000000},{"id":1275,"slug":"find-winner-on-a-tic-tac-toe-game","title":"Find Winner on a Tic Tac Toe Game","difficulty":"Easy","category":"Array","code":"The moves is a list of 0, 0, 2, 0, 1, 1, 2, 1, 2, 2, 1, 0, 0, 1, 0, 2, and 1, 2. The board is a list of 9 zeros. The winner is 0. The turn is 0.\nRepeat while turn is at most 8 and winner is 0.\nThe row is item (turn times 2) of moves. The column is item (turn times 2 plus 1) of moves. The mark is 1. If turn modulo 2 is 1, set mark to 2. Set item (row times 3 plus column) of board to mark. If item 0 of board is item 1 of board and item 1 of board is item 2 of board and item 0 of board is not 0, set winner to item 0 of board. If item 3 of board is item 4 of board and item 4 of board is item 5 of board and item 3 of board is not 0, set winner to item 3 of board. If item 6 of board is item 7 of board and item 7 of board is item 8 of board and item 6 of board is not 0, set winner to item 6 of board. If item 0 of board is item 3 of board and item 3 of board is item 6 of board and item 0 of board is not 0, set winner to item 0 of board. If item 1 of board is item 4 of board and item 4 of board is item 7 of board and item 1 of board is not 0, set winner to item 1 of board. If item 2 of board is item 5 of board and item 5 of board is item 8 of board and item 2 of board is not 0, set winner to item 2 of board. If item 0 of board is item 4 of board and item 4 of board is item 8 of board and item 0 of board is not 0, set winner to item 0 of board. If item 2 of board is item 4 of board and item 4 of board is item 6 of board and item 2 of board is not 0, set winner to item 2 of board. Add 1 to turn.\n\nIf winner is 1, show \"A\". If winner is 2, show \"B\". If winner is 0 and turn is 9, show \"Draw\". If winner is 0 and turn is less than 9, show \"Pending\".\n","expected":"A\n","step_budget":2000000},{"id":1276,"slug":"number-of-burgers-with-no-waste-of-ingredients","title":"Number of Burgers with No Waste of Ingredients","difficulty":"Medium","category":"Math","code":"The tomato is 16, while the cheese is 7. The difference is tomato minus cheese times 2.\nIf difference modulo 2 is 0 and difference is at least 0.\nThe jumbo is difference divided by 2. The small is cheese minus jumbo. Show jumbo. Show small.\n\nIf difference modulo 2 is not 0 or difference is less than 0, show \"none\".\n","expected":"1\n6\n","step_budget":2000000},{"id":1277,"slug":"count-square-submatrices-with-all-ones","title":"Count Square Submatrices with All Ones","difficulty":"Medium","category":"Array","code":"The matrix is a list of 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, and 1. The rows is 3, while the columns is 4. The table is a list of 12 zeros. The total is 0.\nFor every row from 0 to rows minus 1.\nFor every column from 0 to columns minus 1.\nThe index is row times columns plus column.\nIf item index of matrix is 1.\nThe above is 0. The left is 0. The corner is 0. If row is more than 0, set above to item (index minus columns) of table. If column is more than 0, set left to item (index minus 1) of table. If row is more than 0 and column is more than 0, set corner to item (index minus columns minus 1) of table. The small is the smaller of above and left. Set small to the smaller of small and corner. Set item index of table to small plus 1. Increase total by item index of table.\n\nShow total.\n","expected":"15\n","step_budget":2000000},{"id":1278,"slug":"palindrome-partitioning-iii","title":"Palindrome Partitioning III","difficulty":"Hard","category":"String","code":"The word is \"abc\". The parts is 2. Keep a shared size of 3. Keep a shared width of size plus 1. Keep a shared costs as an empty list of whole numbers. Keep a shared scores as an empty list of whole numbers.\nFor every spot from 0 to 8.\nPlace 0 into costs.\n\nFor every spot from 0 to 11.\nPlace 1000000 into scores.\n\nSet item 0 of scores to 0.\nFor every start from 0 to size minus 1.\nFor every finish from start to size minus 1.\nThe left is start. The right is finish.\nRepeat while left is less than right.\nIf character left of word is not character right of word, Set item (start times size plus finish) of costs to item (start times size plus finish) of costs plus 1. Add 1 to left. Subtract 1 from right.\n\nTo measure from cuts (a whole number) with finish (a whole number). The least is 1000000.\nFor every start from 0 to finish minus 1.\nThe previous is item ((cuts minus 1) times width plus start) of scores. The change is item (start times size plus finish minus 1) of costs. The candidate is previous plus change. If candidate is less than least, set least to candidate. Set item (cuts times width plus finish) of scores to least.\n\nFor every cuts from 1 to parts.\nFor every finish from 1 to size.\nMeasure from cuts with finish.\n\nShow item (parts times width plus size) of scores.\n","expected":"1\n","step_budget":2000000},{"id":1281,"slug":"subtract-the-product-and-sum-of-digits-of-an-integer","title":"Subtract the Product and Sum of Digits of an Integer","difficulty":"Easy","category":"Math","code":"The source is 234. The value is source. The product is 1. The sum is 0.\nRepeat while value is more than 0.\nThe digit is value modulo 10. Set product to product times digit. Add digit to sum. Set value to value divided by 10.\n\nThe answer is product minus sum. Show answer.\n","expected":"15\n","step_budget":2000000},{"id":1282,"slug":"group-the-people-given-the-group-size-they-belong-to","title":"Group the People Given the Group Size They Belong To","difficulty":"Medium","category":"Array","code":"Keep a shared sizes holding 3, 3, 3, 3, 3, 1, and 3. Keep a shared people of 7. Keep a shared bucket as a list of 7 zeros. Keep a shared line as empty text. Keep a shared count of 0.\n\nTo gather from target (a whole number). Set count to 0.\nFor every person from 0 to people minus 1.\nIf item person of sizes is target, Set item count of bucket to person, add 1 to count.\n\nTo render from start (a whole number) with target (a whole number). Set line to empty text.\nFor every offset from 0 to target minus 1.\nThe spot is start plus offset. If offset is more than 0, Place \",\" into line. Place format whole number item spot of bucket as text into line.\n\nFor every target from 1 to people.\nGather from target.\nIf count is more than 0.\nThe start is 0.\nRepeat while start is less than count.\nRender from start with target. Show line. Add target to start.\n","expected":"5\n0,1,2\n3,4,6\n","step_budget":2000000},{"id":1283,"slug":"find-the-smallest-divisor-given-a-threshold","title":"Find the Smallest Divisor Given a Threshold","difficulty":"Medium","category":"Array","code":"Keep a shared values holding 1, 2, 5, and 9. Keep a shared total of 0. The limit is 6.\n\nTo measure from divisor (a whole number). Set total to 0.\nFor each value in values.\nThe share is value divided by divisor. If value modulo divisor is not 0, add 1 to share. Add share to total.\n\nThe low is 1. The high is 0. For each value in values, if value is more than high, set high to value. The answer is high.\nRepeat while low is at most high.\nThe middle is the midpoint of low and high. Measure from middle. If total is at most limit, set answer to middle, set high to middle minus 1. If total is more than limit, set low to middle plus 1.\n\nShow answer.\n","expected":"5\n","step_budget":2000000},{"id":1284,"slug":"minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix","title":"Minimum Number of Flips to Convert Binary Matrix to Zero Matrix","difficulty":"Hard","category":"Array","code":"The matrix is a list of 0, 0, 0, and 1. The rows is 2, while the columns is 2. The weights is a list of 1, 2, 4, and 8. The patterns is a list of 4 zeros.\nFor every cell from 0 to 3.\nThe band is cell divided by columns. The file is cell modulo columns. The pattern is item cell of weights. If band is more than 0, set pattern to pattern plus item (cell minus columns) of weights. If band is less than rows minus 1, set pattern to pattern plus item (cell plus columns) of weights. If file is more than 0, set pattern to pattern plus item (cell minus 1) of weights. If file is less than columns minus 1, set pattern to pattern plus item (cell plus 1) of weights. Set item cell of patterns to pattern.\n\nThe seen is a list of 16 zeros. The distance is a list of 16 zeros. The queue is a list of 16 zeros. The start is 8. Set item start of seen to 1. Set item 0 of queue to start. The count is 1. The head is 0. The answer is -1.\nRepeat while head is less than count and answer is less than 0.\nThe state is item head of queue. Add 1 to head. If state is 0, set answer to item state of distance.\nIf state is not 0.\nFor every cell from 0 to 3.\nThe next is exclusive or of state and item cell of patterns.\nIf item next of seen is 0.\nSet item next of seen to 1. Set item next of distance to item state of distance plus 1. Set item count of queue to next. Add 1 to count.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":1287,"slug":"element-appearing-more-than-25-in-sorted-array","title":"Element Appearing More Than 25% In Sorted Array","difficulty":"Easy","category":"Array","code":"The values is a list of 1, 2, 2, 6, 6, 6, 6, 7, and 10. The last is the last position of values. The total is last plus 1. The current is item 0 of values. The run is 0. The answer is 0.\nFor each value in values.\nIf value is current, add 1 to run, otherwise set current to value, set run to 1. If answer is 0 and run times 4 is more than total, set answer to value.\n\nShow answer.\n","expected":"6\n","step_budget":2000000},{"id":1288,"slug":"remove-covered-intervals","title":"Remove Covered Intervals","difficulty":"Medium","category":"Array","code":"The starts is a list of 1, 3, and 2. The ends is a list of 4, 6, and 8. The last is the last position of starts. The answer is 0.\nFor every leftspot from 0 to last.\nThe covered is 0.\nFor every rightspot from 0 to last.\nIf leftspot is not rightspot and item rightspot of starts is at most item leftspot of starts and item leftspot of ends is at most item rightspot of ends, set covered to 1. If rightspot is last and covered is 0, add 1 to answer.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":1289,"slug":"minimum-falling-path-sum-ii","title":"Minimum Falling Path Sum II","difficulty":"Hard","category":"Array","code":"The cells is a list of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The scores is a list of 9 zeros. For every column from 0 to 2, set item column of scores to item column of cells.\nFor every level from 1 to 2.\nFor every column from 0 to 2.\nThe index is level times 3 plus column. The best is 1000000.\nFor every prior from 0 to 2.\nThe above is (level minus 1) times 3 plus prior. The candidate is item above of scores plus item index of cells. If prior is not column and candidate is less than best, set best to candidate. If prior is 2, set item index of scores to best.\n\nThe answer is item 6 of scores.\nFor every column from 1 to 2.\nIf item (6 plus column) of scores is less than answer, set answer to item (6 plus column) of scores.\n\nShow answer.\n","expected":"13\n","step_budget":2000000},{"id":1290,"slug":"convert-binary-number-in-a-linked-list-to-integer","title":"Convert Binary Number in a Linked List to Integer","difficulty":"Easy","category":"Math","code":"The values is a list of 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, and 0. The nexts is a list of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, and -1. The answer is 0. The node is 0.\nRepeat while node is at least 0.\nSet answer to answer times 2 plus item node of values. Set node to item node of nexts.\n\nShow answer.\n","expected":"18880\n","step_budget":2000000},{"id":1291,"slug":"sequential-digits","title":"Sequential Digits","difficulty":"Medium","category":"Enumeration","code":"The low is 100. The high is 300. The answers is an empty list of whole numbers.\nFor every first from 1 to 9.\nThe value is first. The digit is first.\nRepeat while digit is less than 9 and value is at most high.\nAdd 1 to digit. Set value to value times 10 plus digit. If value is at least low and value is at most high, Place value into answers.\n\nThe pieces is an empty list of text.\nFor each answer in answers.\nThe piece is format whole number answer as text. Place piece into pieces.\n\nThe line is join pieces with \",\". Show line.\n","expected":"123,234\n","step_budget":2000000},{"id":1292,"slug":"maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold","title":"Maximum Side Length of a Square with Sum Less than or Equal to Threshold","difficulty":"Medium","category":"Array","code":"The cells is a list of 1, 1, 3, 2, 4, 3, 2, 1, 1, 3, 2, 4, 3, 2, 1, 1, 3, 2, 4, 3, and 2. The height is 3. The width is 7. The threshold is 4. The answer is 0.\nFor every side from 1 to 3.\nThe possible is 0.\nFor every top from 0 to height minus side.\nFor every first from 0 to width minus side.\nThe total is 0.\nFor every down from 0 to side minus 1.\nFor every second from 0 to side minus 1.\nThe spot is (top plus down) times width plus first plus second. Increase total by item spot of cells. If down is side minus 1 and second is side minus 1 and total is at most threshold, set possible to 1. If possible is 1, set answer to side.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":1293,"slug":"shortest-path-in-a-grid-with-obstacles-elimination","title":"Shortest Path in a Grid with Obstacles Elimination","difficulty":"Hard","category":"Array","code":"Keep a shared cells holding 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, and 0. Keep a shared best as an empty list of whole numbers. For every spot from 0 to 14, Place -1 into best. Keep a shared queue as an empty list of whole numbers. Keep a shared remaining as an empty list of whole numbers. Keep a shared distances as an empty list of whole numbers. Keep a shared tally of 1. Keep a shared leftnow of 0. Keep a shared stepsnow of 0.\n\nTo probe from other (a whole number). If other is less than 0 or other is more than 14, return. The cost is 0. If item other of cells is 1, set cost to 1. The after is leftnow minus cost. If after is less than 0, return. If after is at most item other of best, return. Set item other of best to after. Place other into queue. Place after into remaining. Place stepsnow plus 1 into distances. Add 1 to tally.\n\nSet item 0 of best to 1. Place 0 into queue. Place 1 into remaining. Place 0 into distances. The head is 0. The answer is -1.\nRepeat while head is less than tally.\nThe here is item head of queue. The left is item head of remaining. The steps is item head of distances. Add 1 to head. If here is 14, set answer to steps, stop. The band is here divided by 3. The file is here modulo 3. The west is here minus 1. The east is here plus 1. The north is here minus 3. The south is here plus 3. Set leftnow to left. Set stepsnow to steps. If file is more than 0, Probe from west. If file is less than 2, Probe from east. If band is more than 0, Probe from north. If band is less than 4, Probe from south.\n\nShow answer.\n","expected":"6\n","step_budget":2000000},{"id":1295,"slug":"find-numbers-with-even-number-of-digits","title":"Find Numbers with Even Number of Digits","difficulty":"Easy","category":"Array","code":"The numbers is a list of 12, 345, 2, 6, and 7896. The answer is 0.\nFor each value in numbers.\nThe magnitude is value. The digits is 0.\nRepeat while magnitude is more than 0.\nAdd 1 to digits. Set magnitude to magnitude divided by 10. If magnitude is 0 and digits modulo 2 is 0, add 1 to answer.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":1296,"slug":"divide-array-in-sets-of-k-consecutive-numbers","title":"Divide Array in Sets of K Consecutive Numbers","difficulty":"Medium","category":"Array","code":"Keep a shared counts as an empty list of whole numbers. Keep a shared highest of 0. Keep a shared span of 4. Keep a shared possible of 1. The numbers is a list of 1, 2, 3, 3, 4, 4, 5, and 6. The last is the last position of numbers. Set highest to item 0 of numbers.\nFor every spot from 1 to last.\nIf item spot of numbers is more than highest, set highest to item spot of numbers.\n\nFor every spot from 0 to highest, Place 0 into counts.\nFor every spot from 0 to last.\nIncrease item (item spot of numbers) of counts by 1.\n\nTo build from base (a whole number).\nFor every offset from 0 to span minus 1.\nIf possible is 0, return. The wanted is base plus offset. If wanted is more than highest, set possible to 0, return. If item wanted of counts is 0, set possible to 0, return. Decrease item wanted of counts by 1.\n\nFor every value from 0 to highest.\nRepeat while item value of counts is more than 0 and possible is 1.\nBuild from value.\n\nIf possible is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1297,"slug":"maximum-number-of-occurrences-of-a-substring","title":"Maximum Number of Occurrences of a Substring","difficulty":"Medium","category":"String","code":"The source is \"aababcaab\". The maxletters is 2. The span is 3. The size is the number of characters in source. The last is size minus span. The best is 0.\nFor every spot from 0 to last.\nThe piece is the slice of source from spot to spot plus span. The letters is a list of 128 zeros. The distinct is 0.\nFor every offset from 0 to span minus 1.\nThe code is character (spot plus offset) of source. If item code of letters is 0, add 1 to distinct. Set item code of letters to 1.\nIf offset is span minus 1 and distinct is at most maxletters.\nThe matches is 0.\nFor every start from 0 to last.\nThe other is the slice of source from start to start plus span. If other matches piece, add 1 to matches. If matches is more than best, set best to matches.\n\nShow best.\n","expected":"2\n","step_budget":2000000},{"id":1298,"slug":"maximum-candies-you-can-get-from-boxes","title":"Maximum Candies You Can Get from Boxes","difficulty":"Hard","category":"Array","code":"Keep a shared status holding 1, 0, 1, and 0. Keep a shared candies holding 7, 5, 4, and 100. Keep a shared keyfrom as an empty list of whole numbers. Place 2 into keyfrom. Keep a shared keybox as an empty list of whole numbers. Place 1 into keybox. Keep a shared boxstarts holding 0, 1, 2, and 2. Keep a shared boxcounts holding 2, 1, 0, and 0. Keep a shared boxitems holding 1, 2, and 3. Keep a shared held as a list of 4 zeros. Keep a shared opened as a list of 4 zeros. Keep a shared havekey as a list of 4 zeros. Keep a shared queue as an empty list of whole numbers. Keep a shared tally of 0.\n\nTo unlock from box (a whole number).\nFor every key from 0 to the last position of keyfrom.\nIf item key of keyfrom is box.\nThe door is item key of keybox. Set item door of havekey to 1. If item door of held is 1 and item door of opened is 0, Place door into queue, add 1 to tally.\n\nTo offer from box (a whole number). The start is item box of boxstarts. The many is item box of boxcounts.\nIf many is more than 0.\nFor every offset from 0 to many minus 1.\nThe inner is item (start plus offset) of boxitems. Set item inner of held to 1. If item inner of status is 1 or item inner of havekey is 1, Place inner into queue, add 1 to tally.\n\nThe total is 0. Set item 0 of held to 1. Place 0 into queue. Set tally to 1. The head is 0.\nRepeat while head is less than tally.\nThe box is item head of queue. Add 1 to head.\nIf item box of opened is 0.\nSet item box of opened to 1. Increase total by item box of candies. Unlock from box. Offer from box.\n\nShow total.\n","expected":"16\n","step_budget":2000000},{"id":1299,"slug":"replace-elements-with-greatest-element-on-right-side","title":"Replace Elements with Greatest Element on Right Side","difficulty":"Easy","category":"Array","code":"The numbers is a list of 17, 18, 5, 4, 6, and 1. The last is the last position of numbers. The answer is a list of last plus 1 zeros. The greatest is -1.\nFor every offset from 0 to last.\nThe spot is last minus offset. Set item spot of answer to greatest. If item spot of numbers is more than greatest, set greatest to item spot of numbers.\n\nThe line is empty text.\nFor each value in answer.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number value as text into line.\n\nShow line.\n","expected":"18,6,6,6,1,-1\n","step_budget":2000000},{"id":1300,"slug":"sum-of-mutated-array-closest-to-target","title":"Sum of Mutated Array Closest to Target","difficulty":"Medium","category":"Array","code":"The numbers is a list of 4, 9, and 3. The target is 10. The last is the last position of numbers. The highest is item 0 of numbers.\nFor every spot from 1 to last.\nIf item spot of numbers is more than highest, set highest to item spot of numbers.\n\nThe answer is 0. The best is 1000000.\nFor every guess from 0 to highest.\nThe total is 0.\nFor every spot from 0 to last.\nThe capped is item spot of numbers. If capped is more than guess, set capped to guess. Increase total by capped.\nIf spot is last.\nThe difference is total minus target. If difference is less than 0, set difference to 0 minus difference. If difference is less than best, set best to difference, set answer to guess.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":1301,"slug":"number-of-paths-with-max-score","title":"Number of Paths with Max Score","difficulty":"Hard","category":"Array","code":"The board is a list of \"E23\", \"2X2\", and \"12S\". The cells is an empty list of whole numbers.\nFor each band in board.\nFor every column from 0 to 2.\nThe symbol is character column of band. If symbol is \"X\", Place -1 into cells. If symbol is \"E\", Place 0 into cells. If symbol is \"S\", Place 0 into cells. If symbol is between \"0\" and \"9\", The amount is the digit value of symbol, Place amount into cells.\n\nThe scores is a list of 9 zeros. The ways is a list of 9 zeros.\nFor every offset from 0 to 8.\nThe spot is 8 minus offset. If item spot of cells is -1, set item spot of scores to -1.\nIf item spot of cells is not -1.\nIf spot is 8, set item spot of ways to 1.\nIf spot is not 8.\nThe best is -1. The count is 0. If spot plus 3 is at most 8 and item (spot plus 3) of scores is more than best, set best to item (spot plus 3) of scores. If spot modulo 3 is less than 2 and item (spot plus 1) of scores is more than best, set best to item (spot plus 1) of scores. If spot plus 3 is at most 8 and item (spot plus 3) of scores is best and item (spot plus 3) of scores is at least 0, set count to count plus item (spot plus 3) of ways. If spot modulo 3 is less than 2 and item (spot plus 1) of scores is best and item (spot plus 1) of scores is at least 0, set count to count plus item (spot plus 1) of ways. If best is at least 0, set item spot of scores to best plus item spot of cells. If best is at least 0, set item spot of ways to count.\n\nShow item 0 of scores. Show item 0 of ways.\n","expected":"7\n1\n","step_budget":2000000},{"id":1302,"slug":"deepest-leaves-sum","title":"Deepest Leaves Sum","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, 4, 5, -1, 6, 7, -1, -1, -1, -1, and 8. Keep a shared lefts holding 1, 3, 5, 7, 9, -1, 11, -1, -1, -1, -1, -1, and -1. Keep a shared rights holding 2, 4, 6, 8, 10, -1, 12, -1, -1, -1, -1, -1, and -1. Keep a shared best of 0. Keep a shared total of 0.\n\nTo measure from node (a whole number) with level (a whole number). If node is less than 0, return. If item node of values is less than 0, return. If level is more than best, set best to level. Measure from item node of lefts with level plus 1. Measure from item node of rights with level plus 1.\n\nTo gather from node (a whole number) with level (a whole number). If node is less than 0, return. If item node of values is less than 0, return. If level is best, set total to total plus item node of values. Gather from item node of lefts with level plus 1. Gather from item node of rights with level plus 1.\n\nMeasure from 0 with 0. Gather from 0 with 0. Show total.\n","expected":"15\n","step_budget":2000000},{"id":1304,"slug":"find-n-unique-integers-sum-up-to-zero","title":"Find N Unique Integers Sum up to Zero","difficulty":"Easy","category":"Array","code":"The count is 5. The pairs is count divided by 2. The answers is an empty list of whole numbers.\nFor every offset from 0 to pairs minus 1.\nThe value is pairs minus offset. Place 0 minus value into answers.\n\nIf count modulo 2 is 1, Place 0 into answers.\nFor every offset from 0 to pairs minus 1.\nThe value is offset plus 1. Place value into answers.\n\nThe pieces is an empty list of text.\nFor each answer in answers.\nThe piece is format whole number answer as text. Place piece into pieces.\n\nThe line is join pieces with \",\". Show line.\n","expected":"-2,-1,0,1,2\n","step_budget":2000000},{"id":1305,"slug":"all-elements-in-two-binary-search-trees","title":"All Elements in Two Binary Search Trees","difficulty":"Medium","category":"Sorting","code":"Keep a shared firstvalues holding 2, 1, and 4. Keep a shared firstlefts holding 1, -1, and -1. Keep a shared firstrights holding 2, -1, and -1. Keep a shared secondvalues holding 1, 0, and 3. Keep a shared secondlefts holding 1, -1, and -1. Keep a shared secondrights holding 2, -1, and -1. Keep a shared combined as an empty list of whole numbers.\n\nTo gather first from node (a whole number). If node is less than 0, return. Gather first from item node of firstlefts. Place item node of firstvalues into combined. Gather first from item node of firstrights.\n\nTo gather second from node (a whole number). If node is less than 0, return. Gather second from item node of secondlefts. Place item node of secondvalues into combined. Gather second from item node of secondrights.\n\nGather first from 0. Gather second from 0. Sort combined. The pieces is an empty list of text.\nFor each value in combined.\nThe piece is format whole number value as text. Place piece into pieces.\n\nThe line is join pieces with \",\". Show line.\n","expected":"0,1,1,2,3,4\n","step_budget":2000000},{"id":1306,"slug":"jump-game-iii","title":"Jump Game III","difficulty":"Medium","category":"Array","code":"Keep a shared numbers holding 4, 2, 3, 0, 3, 1, and 2. Keep a shared visited as a list of 7 zeros. Keep a shared found of 0.\n\nTo seek from spot (a whole number). If spot is less than 0 or spot is more than 6, return. If item spot of visited is 1, return. Set item spot of visited to 1. If item spot of numbers is 0, set found to 1, return. The jump is item spot of numbers. Seek from (spot minus jump). Seek from (spot plus jump).\n\nSeek from 5. If found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1307,"slug":"verbal-arithmetic-puzzle","title":"Verbal Arithmetic Puzzle","difficulty":"Hard","category":"Array","code":"Keep a shared assigned holding -1, -1, -1, -1, -1, -1, -1, and -1. Keep a shared taken as a list of 10 zeros. Keep a shared leading as a list of 8 zeros. Set item 0 of leading to 1. Set item 4 of leading to 1. Keep a shared addends holding 3, 1, 2, 6, 1, 5, 0, and 4. Keep a shared sumstarts holding 0, 2, 4, 6, and 8. Keep a shared sumcounts holding 2, 2, 2, 2, and 0. Keep a shared letterorder holding 3, 1, 7, 2, 6, 1, 1, 5, 2, 0, 4, 5, and 4. Keep a shared letterstarts holding 0, 3, 6, 9, and 12. Keep a shared lettercounts holding 3, 3, 3, 3, and 1. Keep a shared outputslots holding 7, 1, 2, 5, and 4. Keep a shared found of 0. Keep a shared passing of 0.\n\nTo verify from column (a whole number) with carried (a whole number). The total is carried. The start is item column of sumstarts. The count is item column of sumcounts. If count is more than 0, set total to total plus item (item start of addends) of assigned. If count is more than 1, set total to total plus item (item (start plus 1) of addends) of assigned. The target is 0. If item column of outputslots is at least 0, set target to item (item column of outputslots) of assigned. If total modulo 10 is not target, return. If column is 4 and total divided by 10 is 0, set found to 1, return. If column is 4, return. Fill from column plus 1 with 0 and total divided by 10.\n\nTo pick from column (a whole number) with offset (a whole number) and chosen (a whole number). The slot is item (item column of letterstarts plus offset) of letterorder. Set item slot of assigned to chosen. Set item chosen of taken to 1. Fill from column with offset plus 1 and passing. Set item slot of assigned to -1. Set item chosen of taken to 0.\n\nTo fill from column (a whole number) with offset (a whole number) and carried (a whole number). If found is 1, return. The count is item column of lettercounts. If offset is at least count, Verify from column with carried, return. The start is item column of letterstarts. The slot is item (start plus offset) of letterorder. If item slot of assigned is at least 0, Fill from column with offset plus 1 and carried, return.\nFor every candidate from 0 to 9.\nSet passing to carried. The fresh is 1. If item candidate of taken is 1, set fresh to 0. If item slot of leading is 1 and candidate is 0, set fresh to 0. If fresh is 1, Pick from column with offset and candidate.\n\nFill from 0 with 0 and 0. If found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":11513073},{"id":1309,"slug":"decrypt-string-from-alphabet-to-integer-mapping","title":"Decrypt String from Alphabet to Integer Mapping","difficulty":"Easy","category":"String","code":"The source is \"10#11#12\". The size is the number of characters in source. The alphabet is \"abcdefghijklmnopqrstuvwxyz\". The pieces is an empty list of text. The spot is 0.\nRepeat while spot is less than size.\nThe here is character spot of source. The width is 1. If spot plus 2 is less than size and character (spot plus 2) of source is \"#\", set width to 3. The value is the digit value of here. The nextdigit is 0. If width is 3, set nextdigit to the digit value of character (spot plus 1) of source. If width is 3, set value to value times 10 plus nextdigit. The piece is the slice of alphabet from value minus 1 to value. Place piece into pieces. Add width to spot.\n\nThe line is join pieces with \"\". Show line.\n","expected":"jkab\n","step_budget":2000000},{"id":1310,"slug":"xor-queries-of-a-subarray","title":"XOR Queries of a Subarray","difficulty":"Medium","category":"Array","code":"The numbers is a list of 1, 3, 4, and 8. The lefts is a list of 0, 1, 0, and 3. The rights is a list of 1, 2, 3, and 3. The prefixes is a list of 5 zeros.\nFor every spot from 0 to 3.\nThe mixed is exclusive or of item spot of prefixes and item spot of numbers. Set item (spot plus 1) of prefixes to mixed.\n\nThe pieces is an empty list of text.\nFor every query from 0 to 3.\nThe left is item query of lefts. The right is item query of rights. The value is exclusive or of item (right plus 1) of prefixes and item left of prefixes. The piece is format whole number value as text. Place piece into pieces.\n\nThe line is join pieces with \",\". Show line.\n","expected":"2,7,14,8\n","step_budget":2000000},{"id":1311,"slug":"get-watched-videos-by-your-friends","title":"Get Watched Videos by Your Friends","difficulty":"Medium","category":"Array","code":"Keep a shared names as an empty list of text. Keep a shared counts as an empty list of whole numbers. Keep a shared wantedtext as empty text. Keep a shared total of 0. Keep a shared winner of 0. Keep a shared starts as an empty list of whole numbers. Keep a shared edges as an empty list of whole numbers. Keep a shared degrees as an empty list of whole numbers. Keep a shared videos as an empty list of text. Keep a shared videostarts as an empty list of whole numbers. Keep a shared videosizes as an empty list of whole numbers. Keep a shared depths as an empty list of whole numbers. Keep a shared visited as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared tail of 0. Place 0 into starts. Place 2 into starts. Place 4 into starts. Place 6 into starts. Place 1 into edges. Place 2 into edges. Place 0 into edges. Place 3 into edges. Place 0 into edges. Place 3 into edges. Place 1 into edges. Place 2 into edges. Place 2 into degrees. Place 2 into degrees. Place 2 into degrees. Place 2 into degrees. Place \"A\" into videos. Place \"B\" into videos. Place \"C\" into videos. Place \"B\" into videos. Place \"C\" into videos. Place \"D\" into videos. Place 0 into videostarts. Place 2 into videostarts. Place 3 into videostarts. Place 5 into videostarts. Place 2 into videosizes. Place 1 into videosizes. Place 2 into videosizes. Place 1 into videosizes.\nFor every person from 0 to 3.\nPlace 0 into depths. Place 0 into visited. Place 0 into queue. Place 0 into queue.\n\nTo register. Set found to -1. For every spot from 0 to total minus 1, if item spot of names matches wantedtext, set found to spot. If found is less than 0, Place wantedtext into names, Place 1 into counts, add 1 to total, otherwise set item found of counts to item found of counts plus 1.\n\nTo offer from node (a whole number) with offset (a whole number). The base is item node of videostarts. The video is item (base plus offset) of videos. Set wantedtext to video. Register.\n\nTo gather from node (a whole number). For every offset from 0 to item node of videosizes minus 1, Offer from node with offset.\n\nTo reach from node (a whole number) with offset (a whole number). The base is item node of starts. The target is item (base plus offset) of edges. If item node of depths is less than 1 and item target of visited is 0, Set item target of visited to 1, Set item target of depths to item node of depths plus 1, Set item tail of queue to target, Add 1 to tail.\n\nTo expand from node (a whole number). For every offset from 0 to item node of degrees minus 1, Reach from node with offset.\n\nTo work from node (a whole number). If item node of depths is 1, Gather from node, otherwise Expand from node.\n\nThe head is 0. Set tail to 1. Set item 0 of queue to 0. Set item 0 of visited to 1.\nRepeat while head is less than tail.\nThe node is item head of queue. Add 1 to head. Work from node.\n\nTo compare from other (a whole number) with best (a whole number). The othername is item other of names. The bestname is item best of names. If item other of counts is less than item best of counts or item other of counts is item best of counts and character 0 of othername is less than character 0 of bestname, set winner to other.\n\nTo settle from spot (a whole number). Set winner to spot. For every other from spot plus 1 to total minus 1, Compare from other with winner. The best is winner. The holdname is item spot of names. The holdcount is item spot of counts. Set item spot of names to item best of names. Set item spot of counts to item best of counts. Set item best of names to holdname. Set item best of counts to holdcount.\n\nFor every spot from 0 to total minus 2, Settle from spot. For each name in names, show name.\n","expected":"B\nC\n","step_budget":2000000},{"id":1312,"slug":"minimum-insertion-steps-to-make-a-string-palindrome","title":"Minimum Insertion Steps to Make a String Palindrome","difficulty":"Hard","category":"String","code":"Keep a shared text as empty text. Keep a shared seeds as an empty list of text. Keep a shared table as an empty list of whole numbers. Place \"mbadm\" into seeds. Set text to item 0 of seeds. For every cell from 0 to 24, Place 0 into table.\n\nTo fill from start (a whole number) with finish (a whole number) and length (a whole number). If length is 1, Set item (start times 5 plus finish) of table to 1, otherwise Extend from start with finish.\n\nTo extend from start (a whole number) with finish (a whole number). The here is start times 5 plus finish. The inner is (start plus 1) times 5 plus finish minus 1. The down is (start plus 1) times 5 plus finish. The left is start times 5 plus finish minus 1. The first is character start of text. The second is character finish of text. The best is the larger of item down of table and item left of table. If first is second, Set item here of table to item inner of table plus 2, otherwise Set item here of table to best.\n\nTo row from start (a whole number).\nFor every length from 1 to 5 minus start.\nThe finish is start plus length minus 1. Fill from start with finish and length.\n\nThe start is 4.\nRepeat while start is at least 0.\nRow from start. Decrease start by 1.\n\nShow 5 minus item 4 of table.\n","expected":"2\n","step_budget":2000000},{"id":1313,"slug":"decompress-run-length-encoded-list","title":"Decompress Run-Length Encoded List","difficulty":"Easy","category":"Array","code":"The numbers is a list of 1, 2, 3, and 4.\nFor every pair from 0 to 1.\nThe times is item (pair times 2) of numbers. The value is item (pair times 2 plus 1) of numbers. For every copy from 0 to times minus 1, Show value.\n","expected":"2\n4\n4\n4\n","step_budget":2000000},{"id":1314,"slug":"matrix-block-sum","title":"Matrix Block Sum","difficulty":"Medium","category":"Array","code":"Keep a shared matrix as an empty list of whole numbers. Keep a shared total of 0. Place 1 into matrix. Place 2 into matrix. Place 3 into matrix. Place 4 into matrix. Place 5 into matrix. Place 6 into matrix. Place 7 into matrix. Place 8 into matrix. Place 9 into matrix.\n\nTo sweep from row (a whole number) with column (a whole number). Set total to 0.\nFor every other from 0 to 8.\nThe otherrow is other divided by 3. The othercolumn is other modulo 3. The rowgap is the absolute value of (otherrow minus row). The colgap is the absolute value of (othercolumn minus column). The piece is item other of matrix. If rowgap is at most 1 and colgap is at most 1, add piece to total.\n\nFor every cell from 0 to 8.\nThe row is cell divided by 3. The column is cell modulo 3. Sweep from row with column. Show total.\n","expected":"12\n21\n16\n27\n45\n33\n24\n39\n28\n","step_budget":2000000},{"id":1315,"slug":"sum-of-nodes-with-even-valued-grandparent","title":"Sum of Nodes with Even-Valued Grandparent","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared total of 0. Place 2 into values. Place 4 into values. Place 5 into values. Place 1 into values. Place 3 into values. Place 6 into values. Place 7 into values. Place 1 into lefts. Place 3 into lefts. Place 5 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place 2 into rights. Place 4 into rights. Place 6 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights.\n\nTo walk from node (a whole number) with parent (a whole number) and grand (a whole number). If node is less than 0, return. The left is item node of lefts. The right is item node of rights. The piece is item node of values. Walk from left with node and parent. Walk from right with node and parent. If grand is at least 0 and grand modulo 2 is 0, add piece to total.\n\nWalk from 0 with -1 and -1. Show total.\n","expected":"17\n","step_budget":2000000},{"id":1316,"slug":"distinct-echo-substrings","title":"Distinct Echo Substrings","difficulty":"Hard","category":"String","code":"Keep a shared text as empty text. Keep a shared seeds as an empty list of text. Keep a shared seen as an empty list of text. Keep a shared same of 0. Keep a shared count of 0. Place \"abcabcabc\" into seeds. Set text to item 0 of seeds.\n\nTo check from first (a whole number) with second (a whole number) and span (a whole number). Set same to 1.\nFor every offset from 0 to span minus 1.\nThe one is character (first plus offset) of text. The two is character (second plus offset) of text. If one is not two, set same to 0.\n\nTo collect from start (a whole number) with span (a whole number). The piece is the slice of text from start to start plus span. The known is 0. For every spot from 0 to the last position of seen, if item spot of seen matches piece, set known to 1. If known is 0, Place piece into seen, add 1 to count.\n\nTo probe from start (a whole number) with span (a whole number). Check from start with start plus span and span. If same is 1, Collect from start with span.\n\nTo survey from start (a whole number). The room is 9 minus start. The half is room divided by 2. For every span from 1 to half, Probe from start with span.\n\nFor every start from 0 to 8, Survey from start. Show count.\n","expected":"3\n","step_budget":2000000},{"id":1317,"slug":"convert-integer-to-the-sum-of-two-no-zero-integers","title":"Convert Integer to the Sum of Two No-Zero Integers","difficulty":"Easy","category":"Math","code":"Keep a shared okay of 0. The target is 11.\n\nTo inspect from value (a whole number). Set okay to 1. The written is format whole number value as text.\nFor every spot from 0 to the length of written minus 1.\nThe digit is the digit value of character spot of written. If digit is 0, set okay to 0.\n\nFor every first from 1 to target minus 1.\nThe second is target minus first. Inspect from first. The leftokay is okay. Inspect from second. If leftokay is 1 and okay is 1, Show first, Show second, stop.\n","expected":"2\n9\n","step_budget":2000000},{"id":1318,"slug":"minimum-flips-to-make-a-or-b-equal-to-c","title":"Minimum Flips to Make a OR b Equal to c","difficulty":"Medium","category":"Bit Manipulation","code":"The first is 2. The second is 6. The target is 5. The flips is 0.\nRepeat while first is more than 0 or second is more than 0 or target is more than 0.\nThe firstbit is first modulo 2. The secondbit is second modulo 2. The targetbit is target modulo 2. The wanted is (1 minus firstbit) times (1 minus secondbit). Set first to first divided by 2. Set second to second divided by 2. Set target to target divided by 2. If targetbit is 0, Add firstbit to flips, Add secondbit to flips, otherwise Add wanted to flips.\n\nShow flips.\n","expected":"3\n","step_budget":2000000},{"id":1319,"slug":"number-of-operations-to-make-network-connected","title":"Number of Operations to Make Network Connected","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared starts as an empty list of whole numbers. Keep a shared edges as an empty list of whole numbers. Keep a shared counts as an empty list of whole numbers. Keep a shared seen as an empty list of whole numbers. Keep a shared queue as an empty list of whole numbers. Keep a shared tail of 0. Place 0 into starts. Place 2 into starts. Place 4 into starts. Place 6 into starts. Place 1 into edges. Place 2 into edges. Place 0 into edges. Place 2 into edges. Place 0 into edges. Place 1 into edges. Place 2 into counts. Place 2 into counts. Place 2 into counts. Place 0 into counts. For every node from 0 to 3, Place 0 into seen. For every cell from 0 to 15, Place 0 into queue.\n\nTo reach from node (a whole number).\nFor every offset from 0 to item node of counts minus 1.\nThe base is item node of starts. The target is item (base plus offset) of edges. If item target of seen is 0, Set item target of seen to 1, Set item tail of queue to target, Add 1 to tail.\n\nTo explore from source (a whole number). The head is 0. Set tail to 1. Set item 0 of queue to source. Set item source of seen to 1.\nRepeat while head is less than tail.\nThe node is item head of queue. Add 1 to head. Reach from node.\n\nThe parts is 0. For every source from 0 to 3, if item source of seen is 0, Explore from source, add 1 to parts. The links is 3. The needed is 3. If links is less than needed, Show -1, otherwise Show parts minus 1.\n","expected":"1\n","step_budget":2000000},{"id":1320,"slug":"minimum-distance-to-type-a-word-using-two-fingers","title":"Minimum Distance to Type a Word Using Two Fingers","difficulty":"Hard","category":"String","code":"Keep a shared word as empty text. Keep a shared seeds as an empty list of text. Keep a shared alphabet as empty text. Keep a shared letters as an empty list of text. Keep a shared gaps as an empty list of whole numbers. Keep a shared costs as an empty list of whole numbers. Keep a shared nexts as an empty list of whole numbers. Keep a shared key of 0. Place \"CAKE\" into seeds. Set word to item 0 of seeds. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into letters. Set alphabet to item 0 of letters. For every cell from 0 to 728, Place 0 into gaps. For every cell from 0 to 728, Place 1000000 into costs. For every cell from 0 to 728, Place 1000000 into nexts.\n\nTo locate from spot (a whole number). The symbol is character spot of word. Set key to 0.\nFor every look from 0 to 25.\nThe candidate is character look of alphabet. If candidate is symbol, Set key to look.\n\nTo improve from one (a whole number) with two (a whole number) and goal (a whole number). The here is one times 27 plus two. The value is item here of costs.\nIf value is less than 1000000.\nThe reach is value plus item (one times 27 plus goal) of gaps. The slot is goal times 27 plus two. If reach is less than item slot of nexts, Set item slot of nexts to reach.\n\nTo improveother from one (a whole number) with two (a whole number) and goal (a whole number). The here is one times 27 plus two. The value is item here of costs.\nIf value is less than 1000000.\nThe reach is value plus item (two times 27 plus goal) of gaps. The slot is one times 27 plus goal. If reach is less than item slot of nexts, Set item slot of nexts to reach.\n\nTo relax from one (a whole number) with two (a whole number) and goal (a whole number). Improve from one with two and goal. Improveother from one with two and goal.\n\nTo advance from goal (a whole number). For every cell from 0 to 728, Set item cell of nexts to 1000000.\nFor every one from 0 to 26.\nFor every two from 0 to 26.\nRelax from one with two and goal.\n\nTo adopt.\nFor every cell from 0 to 728.\nSet item cell of costs to item cell of nexts. Set item cell of nexts to 1000000.\n\nFor every one from 0 to 26.\nFor every two from 0 to 26.\nThe rowone is one divided by 6. The colone is one modulo 6. The rowtwo is two divided by 6. The coltwo is two modulo 6. The raw is the absolute value of (rowone minus rowtwo) plus the absolute value of (colone minus coltwo). If one is 26 or two is 26, Set item (one times 27 plus two) of gaps to 0, otherwise Set item (one times 27 plus two) of gaps to raw.\n\nLocate from 0. Set item (key times 27 plus 26) of costs to 0. The start is 1.\nRepeat while start is less than 4.\nLocate from start. The goal is key. Advance from goal. Adopt. Increase start by 1.\n\nThe best is 1000000.\nFor every cell from 0 to 728.\nThe value is item cell of costs. If value is less than best, Set best to value.\n\nShow best.\n","expected":"3\n","step_budget":2252946},{"id":1323,"slug":"maximum-69-number","title":"Maximum 69 Number","difficulty":"Easy","category":"Math","code":"The number is 9669. The written is format whole number number as text. The result is 0. The changed is 0.\nFor every spot from 0 to the length of written minus 1.\nThe digit is the digit value of character spot of written. The chosen is digit. If changed is 0 and digit is 6, set chosen to 9, set changed to 1. Set result to result times 10 plus chosen.\n\nShow result.\n","expected":"9969\n","step_budget":2000000},{"id":1324,"slug":"print-words-vertically","title":"Print Words Vertically","difficulty":"Medium","category":"Array","code":"The source is \"HOW ARE YOU\". The words is split source by \" \".\nFor every level from 0 to 2.\nThe line is empty text. For each word in words, Place character level of word into line. Show line.\n","expected":"HAY\nORO\nWEU\n","step_budget":2000000},{"id":1325,"slug":"delete-leaves-with-a-given-value","title":"Delete Leaves With a Given Value","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared newleft as an empty list of whole numbers. Keep a shared newright as an empty list of whole numbers. Keep a shared resultnode of 0. Keep a shared queue as an empty list of whole numbers. Keep a shared order as an empty list of text. Keep a shared tail of 0. Keep a shared target of 2. Place 1 into values. Place 2 into values. Place 3 into values. Place 2 into values. Place 2 into values. Place 3 into values. Place 4 into values. Place 1 into lefts. Place 3 into lefts. Place 5 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place 2 into rights. Place 4 into rights. Place 6 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights. For every node from 0 to 6, Place 0 into newleft. For every node from 0 to 6, Place 0 into newright. For every cell from 0 to 15, Place 0 into queue.\n\nTo prune from node (a whole number). If node is less than 0, set resultnode to -1, return. The left is item node of lefts. The right is item node of rights. Prune from left. The freshleft is resultnode. Prune from right. The freshright is resultnode. Set item node of newleft to freshleft. Set item node of newright to freshright. The piece is item node of values. If freshleft is less than 0 and freshright is less than 0 and piece is target, set resultnode to -1, otherwise set resultnode to node.\n\nTo spread from node (a whole number). The left is item node of newleft. The right is item node of newright. Set item tail of queue to left. Add 1 to tail. Set item tail of queue to right. Add 1 to tail.\n\nTo handlelive from node (a whole number). The piece is item node of values. The written is format whole number piece as text. Place written into order. Spread from node.\n\nTo handle from node (a whole number). If node is less than 0, Place \"-1\" into order, otherwise Handlelive from node.\n\nPrune from 0. The root is resultnode. The head is 0. Set tail to 1. Set item 0 of queue to root.\nRepeat while head is less than tail.\nThe node is item head of queue. Add 1 to head. Handle from node.\n\nThe mark is \"-1\". The cut is the last position of order.\nRepeat while cut is at least 0.\nThe symbol is item cut of order. If symbol matches mark, set cut to cut minus 1, otherwise stop.\n\nFor every spot from 0 to cut, Show item spot of order.\n","expected":"1\n-1\n3\n3\n4\n","step_budget":2000000},{"id":1326,"slug":"minimum-number-of-taps-to-open-to-water-a-garden","title":"Minimum Number of Taps to Open to Water a Garden","difficulty":"Hard","category":"Array","code":"Keep a shared ranges as an empty list of whole numbers. Keep a shared reach as an empty list of whole numbers. Keep a shared nextedge of 0. Place 3 into ranges. Place 4 into ranges. Place 1 into ranges. Place 1 into ranges. Place 0 into ranges. Place 0 into ranges. For every spot from 0 to 5, Place 0 into reach.\n\nTo offer from tap (a whole number). The span is item tap of ranges. The start is the larger of tap minus span and 0. The finish is the smaller of tap plus span and 5. If finish is more than item start of reach, Set item start of reach to finish.\n\nTo grow from low (a whole number) with high (a whole number). Set nextedge to 0.\nFor every spot from low to high.\nThe here is item spot of reach. If here is more than nextedge, set nextedge to here.\n\nFor every tap from 0 to 5, Offer from tap. The taps is 0. The edge is 0. The low is 0.\nRepeat while edge is less than 5.\nGrow from low with edge. If nextedge is more than edge, Add 1 to taps, Set low to edge plus 1, Set edge to nextedge, otherwise Set taps to -1, stop.\n\nIf taps is at least 0, Show taps.\n","expected":"1\n","step_budget":2000000},{"id":1328,"slug":"break-a-palindrome","title":"Break a Palindrome","difficulty":"Medium","category":"String","code":"Keep a shared word as empty text. Keep a shared seeds as an empty list of text. Keep a shared mark as empty text. Keep a shared lowercode of 0. Place \"abccba\" into seeds. Set word to item 0 of seeds. Set lowercode to character 0 of \"a\". Place character 0 of \"a\" into mark.\n\nTo replace at spot (a whole number). The head is the slice of word from 0 to spot. The tail is the slice of word from spot plus 1 to 6. The parts is a list of head, mark, and tail. The result is join parts with empty text. Show result.\n\nThe spot is 0. The changed is 0.\nRepeat while spot is less than 3 and changed is 0.\nThe piece is character spot of word. The here is spot. Add 1 to spot. If piece is not lowercode, Replace at here, set changed to 1.\n","expected":"aaccba\n","step_budget":2000000},{"id":1329,"slug":"sort-the-matrix-diagonally","title":"Sort the Matrix Diagonally","difficulty":"Medium","category":"Array","code":"Keep a shared matrix as an empty list of whole numbers. Keep a shared pieces as an empty list of whole numbers. Place 3 into matrix. Place 3 into matrix. Place 1 into matrix. Place 1 into matrix. Place 2 into matrix. Place 2 into matrix. Place 1 into matrix. Place 2 into matrix. Place 1 into matrix. Place 1 into matrix. Place 1 into matrix. Place 2 into matrix.\n\nTo trimpieces.\nRepeat while the last position of pieces is at least 0.\nRemove the last item from pieces.\n\nTo collect from row (a whole number) with column (a whole number). The currentrow is row. The currentcolumn is column.\nRepeat while currentrow is less than 3 and currentcolumn is less than 4.\nThe index is currentrow times 4 plus currentcolumn. The value is item index of matrix. Place value into pieces. Add 1 to currentrow. Add 1 to currentcolumn.\n\nTo restore from row (a whole number) with column (a whole number). The currentrow is row. The currentcolumn is column. The cursor is 0.\nRepeat while currentrow is less than 3 and currentcolumn is less than 4.\nThe index is currentrow times 4 plus currentcolumn. Set item index of matrix to item cursor of pieces. Add 1 to cursor. Add 1 to currentrow. Add 1 to currentcolumn.\n\nTo fix from row (a whole number) with column (a whole number). Trimpieces. Collect from row with column. Sort pieces. Restore from row with column.\n\nFor every column from 0 to 3, Fix from 0 with column. For every row from 1 to 2, Fix from row with 0. For every spot from 0 to 11, Show item spot of matrix.\n","expected":"1\n1\n1\n1\n1\n2\n2\n2\n1\n2\n3\n3\n","step_budget":2000000},{"id":1330,"slug":"reverse-subarray-to-maximize-array-value","title":"Reverse Subarray To Maximize Array Value","difficulty":"Hard","category":"Array","code":"Keep a shared numbers as an empty list of whole numbers. Keep a shared total of 0. Keep a shared mapped of 0. Keep a shared best of 0. Place 2 into numbers. Place 3 into numbers. Place 1 into numbers. Place 5 into numbers. Place 4 into numbers.\n\nTo map from spot (a whole number) with left (a whole number) and right (a whole number). If spot is at least left and spot is at most right, Set mapped to left plus right minus spot, otherwise Set mapped to spot.\n\nTo measure from left (a whole number) with right (a whole number). Set total to 0.\nFor every edge from 0 to 3.\nMap from edge with left and right. The first is mapped. Map from edge plus 1 with left and right. The second is mapped. The one is item first of numbers. The two is item second of numbers. The gap is the absolute value of (one minus two). Add gap to total.\n\nTo compare. If total is more than best, Set best to total.\n\nFor every left from 0 to 4.\nFor every right from left to 4.\nMeasure from left with right. Compare.\n\nShow best.\n","expected":"10\n","step_budget":2000000},{"id":1331,"slug":"rank-transform-of-an-array","title":"Rank Transform of an Array","difficulty":"Easy","category":"Array","code":"Keep a shared numbers as an empty list of whole numbers. Keep a shared position of 0. Place 40 into numbers. Place 10 into numbers. Place 20 into numbers. Place 30 into numbers.\n\nTo rank from value (a whole number). Set position to 1.\nFor every other from 0 to 3.\nThe candidate is item other of numbers. If candidate is less than value, add 1 to position.\n\nFor each value in numbers.\nRank from value. Show position.\n","expected":"4\n1\n2\n3\n","step_budget":2000000},{"id":1332,"slug":"remove-palindromic-subsequences","title":"Remove Palindromic Subsequences","difficulty":"Easy","category":"String","code":"The word is \"baabb\". The left is 0. The right is 4. The mirror is 1.\nRepeat while left is less than right.\nThe first is character left of word. The second is character right of word. Add 1 to left. Decrease right by 1. If first is not second, set mirror to 0.\n\nIf mirror is 1, Show 1, otherwise Show 2.\n","expected":"2\n","step_budget":2000000},{"id":1333,"slug":"filter-restaurants-by-vegan-friendly-price-and-distance","title":"Filter Restaurants by Vegan-Friendly, Price and Distance","difficulty":"Medium","category":"Array","code":"Keep a shared rows as an empty list of whole numbers. Keep a shared ids as an empty list of whole numbers. Keep a shared ratings as an empty list of whole numbers. Keep a shared total of 0. Keep a shared winner of 0. Place 1 into rows. Place 4 into rows. Place 1 into rows. Place 40 into rows. Place 10 into rows. Place 2 into rows. Place 8 into rows. Place 0 into rows. Place 50 into rows. Place 5 into rows. Place 3 into rows. Place 8 into rows. Place 1 into rows. Place 30 into rows. Place 4 into rows. Place 4 into rows. Place 10 into rows. Place 0 into rows. Place 10 into rows. Place 3 into rows. Place 5 into rows. Place 1 into rows. Place 1 into rows. Place 15 into rows. Place 1 into rows.\n\nTo consider from restaurant (a whole number). The base is restaurant times 5. The vegan is item (base plus 2) of rows. The price is item (base plus 3) of rows. The distance is item (base plus 4) of rows. If vegan is 1 and price is at most 50 and distance is at most 10, Place item base of rows into ids, Place item (base plus 1) of rows into ratings, Add 1 to total.\n\nTo better from other (a whole number) with best (a whole number). The rating is item other of ratings. The otherid is item other of ids. If rating is more than item best of ratings or rating is item best of ratings and otherid is more than item best of ids, set winner to other.\n\nTo settle from spot (a whole number). Set winner to spot. For every other from spot plus 1 to total minus 1, Better from other with winner. The best is winner. The holdid is item spot of ids. The holdrating is item spot of ratings. Set item spot of ids to item best of ids. Set item spot of ratings to item best of ratings. Set item best of ids to holdid. Set item best of ratings to holdrating.\n\nFor every restaurant from 0 to 4, Consider from restaurant. For every spot from 0 to total minus 2, Settle from spot. For every spot from 0 to total minus 1, Show item spot of ids.\n","expected":"3\n1\n5\n","step_budget":2000000},{"id":1334,"slug":"find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance","title":"Find the City With the Smallest Number of Neighbors at a Threshold Distance","difficulty":"Medium","category":"Dynamic Programming","code":"The cities is 4, while the limit is 4. The links is a list of 0, 1, 3, 1, 2, 1, 1, 3, 4, 2, 3, and 1. The distance is a list of 16 zeros.\nFor every spot from 0 to 15.\nSet item spot of distance to 1000000.\nFor every city from 0 to 3.\nSet item (city times 4 plus city) of distance to 0.\nFor every link from 0 to 3.\nThe start is item (link times 3) of links. The finish is item (link times 3 plus 1) of links. The weight is item (link times 3 plus 2) of links. Set item (start times 4 plus finish) of distance to weight. Set item (finish times 4 plus start) of distance to weight.\n\nFor every middle from 0 to 3.\nFor every start from 0 to 3.\nFor every finish from 0 to 3.\nThe through is item (start times 4 plus middle) of distance plus item (middle times 4 plus finish) of distance. If through is less than item (start times 4 plus finish) of distance, set item (start times 4 plus finish) of distance to through.\n\nThe chosen is -1, while the fewest is 1000000.\nFor every city from 0 to 3.\nThe reach is 0.\nFor every other from 0 to 3.\nIf city is not other and item (city times 4 plus other) of distance is at most limit, add 1 to reach. If reach is at most fewest, set fewest to reach, set chosen to city.\n\nShow chosen.\n","expected":"3\n","step_budget":2000000},{"id":1335,"slug":"minimum-difficulty-of-a-job-schedule","title":"Minimum Difficulty of a Job Schedule","difficulty":"Hard","category":"Array","code":"Keep a shared jobs holding 6, 5, 4, 3, 2, and 1. Keep a shared days of 0. Keep a shared size of 0. Set days to 2. Set size to 6. Keep a shared possible of 0. Keep a shared peak of 0. Keep a shared answer of 0. Set possible to 1. If days is more than size, set possible to 0.\n\nTo weigh from start (a whole number) with finish (a whole number). Set peak to 0.\nFor every job from start to finish.\nIf item job of jobs is more than peak, set peak to item job of jobs.\n\nTo plan. The width is size plus 1. The cells is (days plus 1) times width. The table is a list of cells zeros.\nFor every spot from 0 to the last position of table.\nSet item spot of table to 1000000. Set item 0 of table to 0.\nFor every day from 1 to days.\nFor every finish from 1 to size.\nFor every split from day minus 1 to finish minus 1.\nWeigh from split with finish minus 1. The prior is item ((day minus 1) times width plus split) of table. The candidate is prior plus peak. If candidate is less than item (day times width plus finish) of table, set item (day times width plus finish) of table to candidate. Set answer to item (days times width plus size) of table.\n\nIf possible is 0, show -1. If possible is 1, plan. If possible is 1, show answer.\n","expected":"7\n","step_budget":2000000},{"id":1337,"slug":"the-k-weakest-rows-in-a-matrix","title":"The K Weakest Rows in a Matrix","difficulty":"Easy","category":"Array","code":"The grid is a list of 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, and 1. The rows is 5, while the columns is 5, while the wanted is 3. Keep a shared strengths as an empty list of whole numbers. Keep a shared chosen as an empty list of whole numbers. Keep a shared best of 0. Keep a shared lowest of 0.\nFor every line from 0 to 4.\nPlace 0 into strengths. Place 0 into chosen.\n\nFor every line from 0 to 4.\nThe spot is line times 5.\nRepeat while spot is less than (line plus 1) times 5 and item spot of grid is 1.\nIncrease item line of strengths by 1. Add 1 to spot.\n\nTo choose. Set best to -1. Set lowest to 1000000.\nFor every line from 0 to 4.\nIf item line of chosen is 0 and item line of strengths is less than lowest, set best to line, set lowest to item line of strengths.\n\nFor every pick from 1 to wanted.\nChoose. Set item best of chosen to 1. Show best.\n","expected":"2\n0\n3\n","step_budget":2000000},{"id":1338,"slug":"reduce-array-size-to-the-half","title":"Reduce Array Size to The Half","difficulty":"Medium","category":"Array","code":"The items is a list of 3, 3, 3, 3, 5, 5, 5, 2, 2, and 7. The tally is a list of 8 zeros. The counts is an empty list of whole numbers.\nFor every which from 0 to 9.\nThe value is item which of items. Increase item value of tally by 1.\nFor every value from 0 to 7.\nIf item value of tally is more than 0, Place item value of tally into counts.\n\nFor every spot from 1 to the last position of counts.\nThe hold is item spot of counts. The prior is spot minus 1.\nRepeat while prior is at least 0 and item prior of counts is less than hold.\nSet item (prior plus 1) of counts to item prior of counts. Subtract 1 from prior. Set item (prior plus 1) of counts to hold.\n\nThe target is 5, while the removed is 0, while the answer is 0.\nFor every spot from 0 to the last position of counts.\nIncrease removed by item spot of counts. Add 1 to answer. If removed is at least target, stop.\n\nShow answer.\n","expected":"2\n","step_budget":2000000},{"id":1339,"slug":"maximum-product-of-splitted-binary-tree","title":"Maximum Product of Splitted Binary Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared values holding 1, 2, 3, 4, 5, and 6. Keep a shared lefts holding 1, 3, 5, -1, -1, and -1. Keep a shared rights holding 2, 4, -1, -1, -1, and -1. Keep a shared flow of 0. Keep a shared total of 0. Keep a shared best of 0.\n\nTo gather from node (a whole number). If node is less than 0, set flow to 0, return. Gather from item node of lefts. The leftsize is flow. Gather from item node of rights. The rightsize is flow. Set flow to item node of values plus leftsize plus rightsize.\n\nTo measure from node (a whole number). If node is less than 0, set flow to 0, return. Measure from item node of lefts. The leftsize is flow. Measure from item node of rights. The rightsize is flow. The whole is item node of values plus leftsize plus rightsize.\nIf whole is less than total.\nThe cut is whole times (total minus whole). If cut is more than best, set best to cut. Set flow to whole.\n\nGather from 0. Set total to flow. Measure from 0. Show best.\n","expected":"110\n","step_budget":2000000},{"id":1340,"slug":"jump-game-v","title":"Jump Game V","difficulty":"Hard","category":"Array","code":"Keep a shared heights holding 6, 4, 14, 6, 8, 13, 9, 7, 10, 6, and 12. Keep a shared order as an empty list of whole numbers. Keep a shared lengths as an empty list of whole numbers. Keep a shared span of 0. Keep a shared best of 0. Keep a shared lowest of 0. Keep a shared clear of 0. Keep a shared record of 0. Set span to 2. Set record to 1.\nFor every slot from 0 to 10.\nPlace slot into order. Place 1 into lengths.\n\nTo choose from start (a whole number). Set best to start. Set lowest to item (item start of order) of heights.\nFor every which from start to the last position of order.\nThe spot is item which of order. If item spot of heights is less than lowest, set best to which, set lowest to item spot of heights.\n\nTo inspect from spot (a whole number) with low (a whole number) and high (a whole number). Set clear to 1.\nFor every probe from low plus 1 to high minus 1.\nIf item probe of heights is at least item spot of heights, set clear to 0.\n\nFor every place from 0 to the last position of order.\nChoose from place. swap item place of order and item best of order.\n\nFor every rank from 0 to the last position of order.\nThe spot is item rank of order.\nFor every other from 0 to the last position of heights.\nThe gap is the absolute value of (other minus spot).\nIf item other of heights is less than item spot of heights and gap is at most span.\nThe low is the smaller of spot and other. The high is the larger of spot and other. Set clear to 1. If high is more than low plus 1, inspect from spot with low and high. If clear is 1 and item other of lengths plus 1 is more than item spot of lengths, set item spot of lengths to item other of lengths plus 1. If item spot of lengths is more than record, set record to item spot of lengths.\n\nShow record.\n","expected":"4\n","step_budget":2000000},{"id":1342,"slug":"number-of-steps-to-reduce-a-number-to-zero","title":"Number of Steps to Reduce a Number to Zero","difficulty":"Easy","category":"Math","code":"The number is 14. The steps is 0.\nRepeat while number is more than 0.\nIf number modulo 2 is 0, set number to number divided by 2, otherwise set number to number minus 1. Add 1 to steps.\n\nShow steps.\n","expected":"6\n","step_budget":2000000},{"id":1343,"slug":"number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold","title":"Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold","difficulty":"Medium","category":"Array","code":"The scores is a list of 2, 2, 2, 2, 5, 5, 5, and 8. The width is 3, while the threshold is 4, while the needed is 12. The total is 0, while the answer is 0.\nFor every spot from 0 to the last position of scores.\nIncrease total by item spot of scores. If spot is at least width, set total to total minus item (spot minus width) of scores. If spot is at least width minus 1 and total is at least needed, add 1 to answer.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":1344,"slug":"angle-between-hands-of-a-clock","title":"Angle Between Hands of a Clock","difficulty":"Medium","category":"Math","code":"The hour is 12, while the minutes is 30. The hourhand is (hour modulo 12) times 60 plus minutes. The minutehand is minutes times 12. The gap is the absolute value of (hourhand minus minutehand). The other is 720 minus gap. The answer is gap. If other is less than gap, set answer to other. Set answer to answer divided by 2.\n\nShow answer.\n","expected":"165\n","step_budget":2000000},{"id":1345,"slug":"jump-game-iv","title":"Jump Game IV","difficulty":"Hard","category":"Array","code":"The values is a list of 100, -23, -23, 404, 100, 23, 23, 23, 3, and 404. The distances is a list of 10 zeros. The queue is a list of 10 zeros.\nFor every spot from 0 to 9.\nSet item spot of distances to -1. Set item spot of queue to 0.\n\nSet item 0 of distances to 0. Set item 0 of queue to 0. The head is 0, while the count is 1, while the answer is -1.\nRepeat while head is less than count and answer is less than 0.\nThe node is item head of queue. Add 1 to head. If node is 9, set answer to item node of distances, stop.\nFor every next from 0 to 9.\nIf item next of distances is less than 0.\nThe same is 0. If next is node minus 1 or next is node plus 1, set same to 1. If item next of values is item node of values, set same to 1.\nIf same is 1.\nSet item next of distances to item node of distances plus 1. Set item count of queue to next. Add 1 to count.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":1346,"slug":"check-if-n-and-its-double-exist","title":"Check If N and Its Double Exist","difficulty":"Easy","category":"Array","code":"The numbers is a list of 10, 2, 5, and 3. The found is 0.\nFor every first from 0 to the last position of numbers.\nFor every second from 0 to the last position of numbers.\nIf first is not second and item first of numbers is item second of numbers times 2, set found to 1, stop.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1347,"slug":"minimum-number-of-steps-to-make-two-strings-anagram","title":"Minimum Number of Steps to Make Two Strings Anagram","difficulty":"Medium","category":"String","code":"Keep a shared subject as empty text. Keep a shared glyphs as empty text. Keep a shared mark of 0. Keep a shared counts as an empty list of whole numbers.\nFor every slot from 0 to 25.\nPlace 0 into counts.\n\nPlace \"abcdefghijklmnopqrstuvwxyz\" into glyphs. Place \"bab\" into subject.\n\nTo locate from spot (a whole number). Set mark to -1. The symbol is character spot of subject.\nFor every slot from 0 to 25.\nIf character slot of glyphs is symbol, set mark to slot, return.\n\nFor every spot from 0 to the last position of subject.\nLocate from spot. The local is mark. Increase item local of counts by 1.\n\nSet subject to empty text. Place \"aba\" into subject.\nFor every spot from 0 to the last position of subject.\nLocate from spot. The local is mark. Decrease item local of counts by 1.\n\nThe surplus is 0.\nFor every slot from 0 to 25.\nIf item slot of counts is more than 0, set surplus to surplus plus item slot of counts.\n\nShow surplus.\n","expected":"1\n","step_budget":2000000},{"id":1349,"slug":"maximum-students-taking-exam","title":"Maximum Students Taking Exam","difficulty":"Hard","category":"Array","code":"The seats is a list of \"#\", \".\", \"#\", \"#\", \".\", \"#\", \".\", \"#\", \"#\", \"#\", \"#\", \".\", \"#\", \".\", \"#\", \"#\", \".\", and \"#\". Keep a shared spots as an empty list of whole numbers. Keep a shared taken as an empty list of whole numbers. Keep a shared blocked of 0. Keep a shared best of 0.\nFor every spot from 0 to 17.\nIf item spot of seats matches \".\", Place spot into spots.\n\nFor every spot from 0 to 17.\nPlace 0 into taken.\n\nTo inspect from spot (a whole number). Set blocked to 0.\nFor every other from 0 to 17.\nIf item other of taken is 1.\nThe line is other divided by 6. The column is other modulo 6. The hereline is spot divided by 6. The herecolumn is spot modulo 6. The down is the absolute value of (line minus hereline). The across is the absolute value of (column minus herecolumn). If down is at most 1 and across is at most 1, set blocked to 1, stop.\n\nTo choose from which (a whole number) with students (a whole number). If which is more than the last position of spots, set best to the larger of best and students. If which is more than the last position of spots, return. The spot is item which of spots. Choose from which plus 1 with students. Set blocked to 0. Inspect from spot.\nIf blocked is 0.\nSet item spot of taken to 1. Choose from which plus 1 with students plus 1. Set item spot of taken to 0.\n\nChoose from 0 with 0. Show best.\n","expected":"4\n","step_budget":2000000},{"id":1351,"slug":"count-negative-numbers-in-a-sorted-matrix","title":"Count Negative Numbers in a Sorted Matrix","difficulty":"Easy","category":"Array","code":"Keep a shared grid holding 4, 3, 2, -1, 3, 2, 1, -1, 1, 1, -1, -2, -1, -1, -2, and -3. Keep a shared first of 0. Keep a shared low of 0. Keep a shared high of 0. Keep a shared middle of 0.\n\nTo scan from line (a whole number). Set low to 0. Set high to 3. Set first to 4.\nRepeat while low is at most high.\nSet middle to (low plus high) divided by 2. The value is item (line times 4 plus middle) of grid. If value is less than 0, set first to middle, set high to middle minus 1. If value is at least 0, set low to middle plus 1.\n\nThe answer is 0.\nFor every line from 0 to 3.\nScan from line. Increase answer by 4 minus first.\n\nShow answer.\n","expected":"8\n","step_budget":2000000},{"id":1353,"slug":"maximum-number-of-events-that-can-be-attended","title":"Maximum Number of Events That Can Be Attended","difficulty":"Medium","category":"Array","code":"Keep a shared starts holding 1, 2, and 3. Keep a shared finishes holding 2, 3, and 4. Keep a shared order holding 0, 1, and 2. Keep a shared best of 0. Keep a shared marks as an empty list of whole numbers.\nFor every day from 0 to 5.\nPlace 0 into marks.\n\nKeep a shared answer of 0.\n\nTo choose from start (a whole number). Set best to start.\nFor every which from start to the last position of order.\nThe candidate is item which of order. The pick is best. The current is item pick of order. If item candidate of finishes is less than item current of finishes, set best to which. If item candidate of finishes is item current of finishes and item candidate of starts is less than item current of starts, set best to which.\n\nFor every place from 0 to the last position of order.\nChoose from place. swap item place of order and item best of order.\n\nFor every rank from 0 to the last position of order.\nThe event is item rank of order. The begin is item event of starts. The end is item event of finishes.\nFor every day from begin to end.\nIf item day of marks is 0.\nSet item day of marks to 1. Add 1 to answer. stop.\n\nShow answer.\n","expected":"3\n","step_budget":2000000},{"id":1354,"slug":"construct-target-array-with-multiple-sums","title":"Construct Target Array With Multiple Sums","difficulty":"Hard","category":"Array","code":"Keep a shared target holding 9, 3, and 5. Keep a shared size of 0. Keep a shared total of 0. Keep a shared top of 0. Keep a shared rest of 0. Keep a shared next of 0. Keep a shared possible of 0. Set size to 3. Set total to 17. Set possible to 1.\n\nTo highest. Set top to 0.\nFor every spot from 0 to the last position of target.\nThe place is top. If item spot of target is more than item place of target, set top to spot.\n\nRepeat while total is more than size.\nHighest. The place is top. Set rest to total minus item place of target. If item place of target is at most rest, set possible to 0, stop. Set next to item place of target minus rest. Set item place of target to next. Set total to rest plus next.\n\nIf possible is 0, show false, otherwise show true.\n","expected":"true\n","step_budget":2000000},{"id":1356,"slug":"sort-integers-by-the-number-of-1-bits","title":"Sort Integers by The Number of 1 Bits","difficulty":"Easy","category":"Array","code":"Keep a shared values holding 0, 1, 2, 3, 4, 5, 6, 7, and 8. Keep a shared weights as an empty list of whole numbers.\nFor every spot from 0 to 8.\nPlace 0 into weights.\n\nKeep a shared bits of 0. Keep a shared best of 0. Keep a shared lowest of 0. Keep a shared lowbits of 0.\n\nTo weigh from value (a whole number). Set bits to 0. The left is value.\nRepeat while left is more than 0.\nIf left modulo 2 is 1, add 1 to bits. Set left to left divided by 2.\n\nTo choose from start (a whole number). Set best to start. Set lowbits to item start of weights.\nFor every which from start to the last position of values.\nThe pick is best. If item which of weights is less than lowbits, set best to which, set lowbits to item which of weights. If item which of weights is lowbits and item which of values is less than item pick of values, set best to which.\n\nFor every spot from 0 to the last position of values.\nWeigh from item spot of values. Set item spot of weights to bits.\n\nThe last is the last position of values.\nFor every place from 0 to last minus 1.\nChoose from place. swap item place of values and item best of values. swap item place of weights and item best of weights.\n\nFor every value in values.\nShow value.\n","expected":"0\n1\n2\n4\n8\n3\n5\n6\n7\n","step_budget":2000000},{"id":1358,"slug":"number-of-substrings-containing-all-three-characters","title":"Number of Substrings Containing All Three Characters","difficulty":"Medium","category":"String","code":"The text is \"abcabc\". The lastplaces is a list of 3 zeros. Set item 0 of lastplaces to -1. Set item 1 of lastplaces to -1. Set item 2 of lastplaces to -1. The answer is 0.\nFor every spot from 0 to the last position of text.\nThe symbol is character spot of text. If symbol is \"a\", set item 0 of lastplaces to spot. If symbol is \"b\", set item 1 of lastplaces to spot. If symbol is \"c\", set item 2 of lastplaces to spot.\nIf item 0 of lastplaces is at least 0 and item 1 of lastplaces is at least 0 and item 2 of lastplaces is at least 0.\nThe low is the smaller of item 0 of lastplaces and item 1 of lastplaces. The low is the smaller of low and item 2 of lastplaces. Increase answer by low plus 1.\n\nShow answer.\n","expected":"10\n","step_budget":2000000},{"id":1359,"slug":"count-all-valid-pickup-and-delivery-options","title":"Count All Valid Pickup and Delivery Options","difficulty":"Hard","category":"Math","code":"The orders is 3, while the modulus is 1000000007. The answer is 1.\nFor every step from 1 to orders.\nSet answer to answer times step times (step times 2 minus 1) modulo modulus.\n\nShow answer.\n","expected":"90\n","step_budget":2000000},{"id":1360,"slug":"number-of-days-between-two-dates","title":"Number of Days Between Two Dates","difficulty":"Easy","category":"String","code":"Keep a shared first as empty text. Keep a shared second as empty text. Keep a shared parts as an empty list of text. Keep a shared months holding 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, and 31. Place \"2020-01-15\" into first. Place \"2019-12-31\" into second. Keep a shared amount of 0. Keep a shared leaps of 0. Keep a shared daysbefore of 0. Keep a shared yearone of 0. Keep a shared monthone of 0. Keep a shared dayone of 0. Keep a shared yeartwo of 0. Keep a shared monthtwo of 0. Keep a shared daytwo of 0.\n\nTo absorb from which (a whole number). Set amount to 0. The part is item which of parts.\nFor every spot from 0 to the last position of part.\nThe digit is the digit value of character spot of part. Set amount to amount times 10 plus digit.\n\nTo count leaps with year (a whole number). Set leaps to 0.\nIf year is more than 0.\nSet leaps to (year minus 1) divided by 4 minus (year minus 1) divided by 100 plus (year minus 1) divided by 400.\n\nTo count days from month (a whole number) with year (a whole number). Set daysbefore to 0.\nFor every which from 1 to month minus 1.\nIncrease daysbefore by item (which minus 1) of months. If which is 2 and year modulo 4 is 0 and (year modulo 100 is not 0 or year modulo 400 is 0), add 1 to daysbefore.\n\nSet parts to split first by \"-\". Absorb from 0. Set yearone to amount. Absorb from 1. Set monthone to amount. Absorb from 2. Set dayone to amount. Set parts to split second by \"-\". Absorb from 0. Set yeartwo to amount. Absorb from 1. Set monthtwo to amount. Absorb from 2. Set daytwo to amount.\n\nCount leaps with yearone. Count days from monthone with yearone. The start is yearone times 365 plus leaps plus daysbefore plus dayone. Count leaps with yeartwo. Count days from monthtwo with yeartwo. The finish is yeartwo times 365 plus leaps plus daysbefore plus daytwo. The gap is the absolute value of (start minus finish).\n\nShow gap.\n","expected":"15\n","step_budget":2000000},{"id":1361,"slug":"validate-binary-tree-nodes","title":"Validate Binary Tree Nodes","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared lefts holding 1, -1, 3, and -1. Keep a shared rights holding 2, -1, -1, and -1. Keep a shared indegree as an empty list of whole numbers.\nFor every node from 0 to 3.\nPlace 0 into indegree.\n\nKeep a shared bad of 0.\n\nTo note from child (a whole number). If child is -1, return. If item child of indegree is more than 0, set bad to 1. Increase item child of indegree by 1.\n\nFor each child in lefts.\nNote from child.\n\nFor each child in rights.\nNote from child.\n\nThe root is -1. The roots is 0.\nFor every node from 0 to 3.\nIf item node of indegree is 0, set root to node, add 1 to roots.\n\nKeep a shared visited as an empty list of whole numbers.\nFor every node from 0 to 3.\nPlace 0 into visited.\n\nKeep a shared reached of 0.\n\nTo walk from node (a whole number). If node is less than 0, return. If item node of visited is 1, return. Set item node of visited to 1. Add 1 to reached. Walk from item node of lefts. Walk from item node of rights.\n\nIf roots is 1, Walk from root. If bad is 0 and roots is 1 and reached is 4, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1362,"slug":"closest-divisors","title":"Closest Divisors","difficulty":"Medium","category":"Math","code":"Keep a shared low of 0. Keep a shared high of 0. Keep a shared bestgap of 1000000.\n\nTo consider from factor (a whole number) with value (a whole number). The other is value divided by factor. The gap is other minus factor. If factor is at most other and gap is less than bestgap, set bestgap to gap, set low to factor, set high to other.\n\nTo inspect from value (a whole number).\nFor every factor from 1 to value.\nIf value modulo factor is 0, Consider from factor with value.\n\nInspect from 9. Inspect from 10. Show low. Show high.\n","expected":"3\n3\n","step_budget":2000000},{"id":1363,"slug":"largest-multiple-of-three","title":"Largest Multiple of Three","difficulty":"Hard","category":"Array","code":"The digits is a list of 8, 1, and 9. Keep a shared counts as an empty list of whole numbers.\nFor every digit from 0 to 9.\nPlace 0 into counts.\n\nThe total is 0.\nFor each digit in digits.\nIncrease item digit of counts by 1. Add digit to total.\n\nThe remainder is total modulo 3. Keep a shared taken of 0. Keep a shared line as empty text.\n\nTo removeone from kind (a whole number). Set taken to 0. The digit is 0.\nRepeat while digit is at most 9.\nIf item digit of counts is more than 0 and digit modulo 3 is kind, set item digit of counts to item digit of counts minus 1, set taken to 1, stop. Add 1 to digit.\n\nTo drop from kind (a whole number). Removeone from kind. Removeone from kind.\n\nTo emit from digit (a whole number). The many is item digit of counts.\nRepeat while many is more than 0.\nPlace format whole number digit as text into line. Subtract 1 from many.\n\nIf remainder is 1, Removeone from 1. If remainder is 1 and taken is 0, Drop from 2. If remainder is 2, Removeone from 2. If remainder is 2 and taken is 0, Drop from 1.\n\nThe high is -1.\nFor every digit from 0 to 9.\nIf item digit of counts is more than 0, set high to digit.\n\nIf high is more than 0.\nFor every step from 0 to 9.\nThe digit is 9 minus step. Emit from digit.\n\nIf high is more than 0, show line.\n\nIf high is 0, show 0.\n","expected":"981\n","step_budget":2000000},{"id":1365,"slug":"how-many-numbers-are-smaller-than-the-current-number","title":"How Many Numbers Are Smaller Than the Current Number","difficulty":"Easy","category":"Array","code":"Keep a shared numbers holding 8, 1, 2, 2, and 3. Keep a shared smaller of 0. Keep a shared target of 0.\n\nTo tally. Set smaller to 0.\nFor each other in numbers.\nIf other is less than target, add 1 to smaller.\n\nThe answers is an empty list of whole numbers.\nFor each value in numbers.\nSet target to value. Tally. Place smaller into answers.\n\nThe line is empty text.\nFor each count in answers.\nIf the length of line is more than 0, Place \",\" into line. Place format whole number count as text into line.\n\nShow line.\n","expected":"4,0,1,1,3\n","step_budget":2000000},{"id":1366,"slug":"rank-teams-by-votes","title":"Rank Teams by Votes","difficulty":"Medium","category":"Array","code":"Keep a shared alphabet as empty text. Place \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" into alphabet. Keep a shared width of 0. Keep a shared last of 0. Keep a shared counts as an empty list of whole numbers. Keep a shared teams as an empty list of whole numbers. Keep a shared used as an empty list of whole numbers. Keep a shared index of 0. Keep a shared wanted as empty text. Keep a shared earlier of 0. Keep a shared best of 0.\n\nThe votes is a list of \"ABC\", \"ACB\", \"ABC\", \"ACB\", and \"ACB\". The firstvote is item 0 of votes. Set last to the last position of firstvote. Set width to last plus 1.\nFor every cell from 0 to 676 minus 1.\nPlace 0 into counts.\n\nTo locate. The spot is 0.\nRepeat while spot is at most 25.\nIf the slice of alphabet from spot to spot plus 1 matches wanted, set index to spot, return. Add 1 to spot.\n\nFor each vote in votes.\nThe spot is 0.\nRepeat while spot is less than width.\nThe symbol is the slice of vote from spot to spot plus 1. Set wanted to symbol. Locate. Increase item (index times width plus spot) of counts by 1. Add 1 to spot.\n\nFor every spot from 0 to width minus 1.\nThe symbol is the slice of firstvote from spot to spot plus 1. Set wanted to symbol. Locate. Place index into teams.\n\nFor every spot from 0 to 25.\nPlace 0 into used.\n\nTo compare with first (a whole number) and second (a whole number). Set earlier to 0. If first is less than second, set earlier to 1. The spot is 0.\nRepeat while spot is less than width.\nThe one is item (first times width plus spot) of counts. The two is item (second times width plus spot) of counts. If one is more than two, set earlier to 1, return. If one is less than two, set earlier to 0, return. Add 1 to spot.\n\nTo consider with candidate (a whole number). If item candidate of used is 1, return. If best is less than 0, set best to candidate, return. Compare with candidate and best. If earlier is 1, set best to candidate.\n\nTo choose. Set best to -1.\nFor each candidate in teams.\nConsider with candidate.\n\nThe order is an empty list of whole numbers.\nFor every slot from 0 to width minus 1.\nChoose. Set item best of used to 1. Place best into order.\n\nThe line is empty text.\nFor each choice in order.\nThe symbol is the slice of alphabet from choice to choice plus 1. Place symbol into line.\n\nShow line.\n","expected":"ACB\n","step_budget":2000000},{"id":1367,"slug":"linked-list-in-binary-tree","title":"Linked List in Binary Tree","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared heads holding 4, 2, and 8. Keep a shared values holding 1, 4, 4, 2, 2, 1, 6, 8, 1, and 3. Keep a shared lefts holding 1, -1, 4, 5, 6, -1, -1, 8, -1, and -1. Keep a shared rights holding 2, 3, -1, -1, 7, -1, -1, 9, -1, and -1. Keep a shared found of 0. Keep a shared last of 0.\n\nSet last to the last position of heads.\n\nTo match from node (a whole number) with depth (a whole number). If node is less than 0, return. If found is 1, return. If item node of values is not item depth of heads, return. If depth is last, set found to 1, return. Match from item node of lefts with depth plus 1. Match from item node of rights with depth plus 1.\n\nFor every node from 0 to 9.\nMatch from node with 0.\n\nIf found is 1, show true, otherwise show false.\n","expected":"true\n","step_budget":2000000},{"id":1368,"slug":"minimum-cost-to-make-at-least-one-valid-path-in-a-grid","title":"Minimum Cost to Make at Least One Valid Path in a Grid","difficulty":"Hard","category":"Array","code":"Keep a shared grid holding 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, and 2. Keep a shared distance as an empty list of whole numbers.\nFor every spot from 0 to 15.\nPlace 1000 into distance.\n\nSet item 0 of distance to 0. Keep a shared here of 0.\n\nTo relax from target (a whole number) with cost (a whole number). If target is less than 0, return. If target is more than 15, return. If item target of distance is more than here plus cost, set item target of distance to here plus cost.\n\nRepeat 40 times.\nFor every cell from 0 to 15.\nThe row is cell divided by 4. The column is cell modulo 4. Set here to item cell of distance. The rightcost is 1. The leftcost is 1. The downcost is 1. The upcost is 1. If item cell of grid is 1, set rightcost to 0. If item cell of grid is 2, set leftcost to 0. If item cell of grid is 3, set downcost to 0. If item cell of grid is 4, set upcost to 0. If column is less than 3, Relax from cell plus 1 with rightcost. If column is more than 0, Relax from cell minus 1 with leftcost. If row is less than 3, Relax from cell plus 4 with downcost. If row is more than 0, Relax from cell minus 4 with upcost.\n\nShow item 15 of distance.\n","expected":"3\n","step_budget":2000000},{"id":1370,"slug":"increasing-decreasing-string","title":"Increasing Decreasing String","difficulty":"Easy","category":"String","code":"Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared counts as an empty list of whole numbers.\nFor every letter from 0 to 25.\nPlace 0 into counts.\n\nKeep a shared wanted as empty text. Keep a shared slot of 0. Keep a shared left of 0. Keep a shared line as empty text.\n\nTo rank. The spot is 0.\nRepeat while spot is at most 25.\nIf the slice of alphabet from spot to spot plus 1 matches wanted, set slot to spot, return. Add 1 to spot.\n\nThe word is \"aaaabbbbcccc\". The last is the last position of word. Set left to last plus 1.\nFor every spot from 0 to last.\nThe symbol is the slice of word from spot to spot plus 1. Set wanted to symbol. Rank. The at is slot. Increase item at of counts by 1.\n\nTo lift.\nFor every letter from 0 to 25.\nThe many is item letter of counts.\nIf many is more than 0.\nThe symbol is the slice of alphabet from letter to letter plus 1. Place symbol into line. Set item letter of counts to many minus 1. Subtract 1 from left.\n\nTo lower.\nFor every step from 0 to 25.\nThe letter is 25 minus step. The many is item letter of counts.\nIf many is more than 0.\nThe symbol is the slice of alphabet from letter to letter plus 1. Place symbol into line. Set item letter of counts to many minus 1. Subtract 1 from left.\n\nRepeat while left is more than 0.\nLift. Lower.\n\nShow line.\n","expected":"abccbaabccba\n","step_budget":2000000},{"id":1371,"slug":"find-the-longest-substring-containing-vowels-in-even-counts","title":"Find the Longest Substring Containing Vowels in Even Counts","difficulty":"Medium","category":"String","code":"Keep a shared alphabet as empty text. Place \"abcdefghijklmnopqrstuvwxyz\" into alphabet. Keep a shared masks as an empty list of whole numbers.\nFor every letter from 0 to 25.\nPlace 0 into masks.\n\nSet item 0 of masks to 1. Set item 4 of masks to 2. Set item 8 of masks to 4. Set item 14 of masks to 8. Set item 20 of masks to 16. Keep a shared earliest as an empty list of whole numbers.\nFor every state from 0 to 31.\nPlace -2 into earliest.\n\nKeep a shared wanted as empty text. Keep a shared slot of 0.\n\nTo rank. The spot is 0.\nRepeat while spot is at most 25.\nIf the slice of alphabet from spot to spot plus 1 matches wanted, set slot to spot, return. Add 1 to spot.\n\nThe word is \"eleetminicoworoep\". The last is the last position of word. Set item 0 of earliest to -1. Keep a shared state of 0. The best is 0.\nFor every position from 0 to last.\nThe symbol is the slice of word from position to position plus 1. Set wanted to symbol. Rank. The at is slot. The bit is item at of masks. The current is state. Set state to exclusive or of current and bit. The fresh is state. The start is item fresh of earliest. If start is less than -1, set item fresh of earliest to position. If start is at least -1, The span is position minus start, If span is more than best, set best to span.\n\nShow best.\n","expected":"13\n","step_budget":2000000},{"id":1372,"slug":"longest-zigzag-path-in-a-binary-tree","title":"Longest ZigZag Path in a Binary Tree","difficulty":"Medium","category":"Dynamic Programming","code":"Keep a shared values holding 1, 1, 1, 1, 1, 1, 1, and 1. Keep a shared lefts holding -1, 2, -1, 4, -1, -1, -1, and -1. Keep a shared rights holding 1, 3, -1, 5, 6, -1, 7, and -1. Keep a shared best of 0.\n\nTo walk from node (a whole number) with direction (a whole number) and length (a whole number). If node is less than 0, return. If length is more than best, set best to length. The left is item node of lefts. The right is item node of rights. The leftlength is 1. If direction is 1, set leftlength to length plus 1. The rightlength is 1. If direction is 0, set rightlength to length plus 1. Walk from left with 0 and leftlength. Walk from right with 1 and rightlength.\n\nWalk from 0 with 0 and 0. Show best.\n","expected":"3\n","step_budget":2000000},{"id":1373,"slug":"maximum-sum-bst-in-binary-tree","title":"Maximum Sum BST in Binary Tree","difficulty":"Hard","category":"Dynamic Programming","code":"Keep a shared values holding 1, 4, 3, 2, 4, 2, 5, 4, and 6. Keep a shared lefts holding 1, 3, 5, -1, -1, -1, 7, -1, and -1. Keep a shared rights holding 2, 4, 6, -1, -1, -1, 8, -1, and -1. Keep a shared valid as an empty list of whole numbers.\nFor every node from 0 to 8.\nPlace 0 into valid.\n\nKeep a shared lows as an empty list of whole numbers.\nFor every node from 0 to 8.\nPlace 0 into lows.\n\nKeep a shared highs as an empty list of whole numbers.\nFor every node from 0 to 8.\nPlace 0 into highs.\n\nKeep a shared sums as an empty list of whole numbers.\nFor every node from 0 to 8.\nPlace 0 into sums.\n\nKeep a shared value of 0. Keep a shared good of 0. Keep a shared low of 0. Keep a shared high of 0. Keep a shared total of 0. Keep a shared best of 0.\n\nTo inspectleft from child (a whole number). If child is less than 0, return. If item child of valid is 0, set good to 0, return. If item child of highs is at least value, set good to 0, return. Set low to item child of lows. Increase total by item child of sums.\n\nTo inspectright from child (a whole number). If child is less than 0, return. If item child of valid is 0, set good to 0, return. If item child of lows is at most value, set good to 0, return. Set high to item child of highs. Increase total by item child of sums.\n\nTo score from node (a whole number). If node is less than 0, return. Score from item node of lefts. Score from item node of rights. Set value to item node of values. Set good to 1. Set low to value. Set high to value. Set total to value. Inspectleft from item node of lefts. Inspectright from item node of rights. Set item node of valid to good. Set item node of lows to low. Set item node of highs to high. Set item node of sums to total. If good is 1 and total is more than best, set best to total.\n\nScore from 0. Show best.\n","expected":"20\n","step_budget":2000000},{"id":1374,"slug":"generate-a-string-with-characters-that-have-odd-counts","title":"Generate a String With Characters That Have Odd Counts","difficulty":"Easy","category":"String","code":"The size is 4. The amount is 4. Keep a shared extra as empty text. Place \"z\" into extra. If size modulo 2 is 1, set extra to empty text. If size modulo 2 is 0, set amount to size minus 1. The line is empty text.\nFor every spot from 1 to amount.\nPlace \"p\" into line.\n\nPlace extra into line. Show line.\n","expected":"pppz\n","step_budget":2000000},{"id":1375,"slug":"number-of-times-binary-string-is-prefix-aligned","title":"Number of Times Binary String Is Prefix-Aligned","difficulty":"Medium","category":"Array","code":"The flips is a list of 3, 2, 4, 1, and 5. The size is 5. Keep a shared seen as an empty list of whole numbers.\nFor every spot from 0 to 5.\nPlace 0 into seen.\n\nThe highest is 0. The moments is 0.\nFor every step from 0 to size minus 1.\nThe flip is item step of flips. Set item flip of seen to 1. If flip is more than highest, set highest to flip. If highest is step plus 1, add 1 to moments.\n\nShow moments.\n","expected":"2\n","step_budget":2000000},{"id":1376,"slug":"time-needed-to-inform-all-employees","title":"Time Needed to Inform All Employees","difficulty":"Medium","category":"Depth-First Search","code":"Keep a shared manager holding 2, 2, -1, 2, 2, and 2. Keep a shared informTime holding 0, 0, 1, 0, 0, and 0. Keep a shared total of 0. Keep a shared best of 0.\n\nTo measure from employee (a whole number). Set total to 0. The current is employee.\nRepeat while item current of manager is not -1.\nThe boss is item current of manager. Increase total by item boss of informTime. Set current to boss.\n\nFor every employee from 0 to 5.\nMeasure from employee. If total is more than best, set best to total.\n\nShow best.\n","expected":"1\n","step_budget":2000000},{"id":1377,"slug":"frog-position-after-t-seconds","title":"Frog Position After T Seconds","difficulty":"Hard","category":"Depth-First Search","code":"Keep a shared links as an empty list of whole numbers.\nFor every cell from 0 to 63.\nPlace 0 into links.\n\nTo join 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.\n\nJoin from 1 with 2. Join from 1 with 3. Join from 1 with 7. Join from 2 with 4. Join from 2 with 6. Join from 3 with 5. Keep a shared nodes as an empty list of whole numbers. Place 1 into nodes. Keep a shared parents as an empty list of whole numbers. Place 0 into parents. Keep a shared depths as an empty list of whole numbers. Place 0 into depths. Keep a shared chances as an empty list of decimals. Place 1.0 into chances. Keep a shared kids of 0. Keep a shared count of 0. Keep a shared limit of 0. Keep a shared target of 0. Keep a shared result as a decimal. Keep a shared chance as a decimal. Keep a shared share as a decimal.\n\nTo countkids from node (a whole number) with parent (a whole number). Set kids to 0.\nFor every neighbor from 1 to 7.\nIf item (node times 8 plus neighbor) of links is 1 and neighbor is not parent, add 1 to kids.\n\nTo spread from node (a whole number) with code (a whole number). The parent is code divided by 100. The depth is code modulo 100. If depth is at least limit, return. If kids is 0, return. Set share to chance divided by kids as a decimal.\nFor every neighbor from 1 to 7.\nIf item (node times 8 plus neighbor) of links is 1 and neighbor is not parent.\nPlace neighbor into nodes. Place node into parents. Place depth plus 1 into depths. Place share into chances. Add 1 to count.\n\nSet limit to 2. Set target to 4. The head is 0. Set count to 1.\nRepeat while head is less than count.\nThe node is item head of nodes. The parent is item head of parents. The depth is item head of depths. Set chance to item head of chances. Countkids from node with parent. If node is target and depth is limit, add chance to result. If node is target and depth is less than limit and kids is 0, add chance to result. The code is parent times 100 plus depth. Spread from node with code. Add 1 to head.\n\nShow result.\n","expected":"0.1667\n","step_budget":2000000},{"id":1379,"slug":"find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree","title":"Find a Corresponding Node of a Binary Tree in a Clone of That Tree","difficulty":"Easy","category":"Depth-First Search","code":"Keep a shared cloned holding 7, 4, 3, 6, and 19. Keep a shared clonelefts holding 1, -1, 3, -1, and -1. Keep a shared clonerights holding 2, -1, 4, -1, and -1. Keep a shared target of 3. Keep a shared found of 0.\n\nTo seek from node (a whole number). If node is less than 0, return. If item node of cloned is target, set found to node, return. Seek from item node of clonelefts. Seek from item node of clonerights.\n\nSeek from 0. The at is found. Show item at of cloned.\n","expected":"3\n","step_budget":2000000}]
