offcode 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -2
- package/data/index.json +1 -0
- package/data/problems/01-matrix.json +1 -0
- package/data/problems/1-bit-and-2-bit-characters.json +1 -0
- package/data/problems/132-pattern.json +1 -0
- package/data/problems/2-keys-keyboard.json +1 -0
- package/data/problems/24-game.json +1 -0
- package/data/problems/3sum-closest.json +1 -0
- package/data/problems/3sum-smaller.json +1 -0
- package/data/problems/3sum-with-multiplicity.json +1 -0
- package/data/problems/3sum.json +1 -0
- package/data/problems/4-keys-keyboard.json +1 -0
- package/data/problems/4sum-ii.json +1 -0
- package/data/problems/4sum.json +1 -0
- package/data/problems/accounts-merge.json +1 -0
- package/data/problems/add-binary.json +1 -0
- package/data/problems/add-bold-tag-in-string.json +1 -0
- package/data/problems/add-digits.json +1 -0
- package/data/problems/add-one-row-to-tree.json +1 -0
- package/data/problems/add-strings.json +1 -0
- package/data/problems/add-to-array-form-of-integer.json +1 -0
- package/data/problems/add-two-numbers-ii.json +1 -0
- package/data/problems/add-two-numbers.json +1 -0
- package/data/problems/additive-number.json +1 -0
- package/data/problems/advantage-shuffle.json +1 -0
- package/data/problems/alien-dictionary.json +1 -0
- package/data/problems/all-nodes-distance-k-in-binary-tree.json +1 -0
- package/data/problems/all-oone-data-structure.json +1 -0
- package/data/problems/all-paths-from-source-to-target.json +1 -0
- package/data/problems/all-possible-full-binary-trees.json +1 -0
- package/data/problems/ambiguous-coordinates.json +1 -0
- package/data/problems/android-unlock-patterns.json +1 -0
- package/data/problems/arithmetic-slices-ii-subsequence.json +1 -0
- package/data/problems/arithmetic-slices.json +1 -0
- package/data/problems/arranging-coins.json +1 -0
- package/data/problems/array-nesting.json +1 -0
- package/data/problems/array-of-doubled-pairs.json +1 -0
- package/data/problems/array-partition.json +1 -0
- package/data/problems/assign-cookies.json +1 -0
- package/data/problems/asteroid-collision.json +1 -0
- package/data/problems/available-captures-for-rook.json +1 -0
- package/data/problems/average-of-levels-in-binary-tree.json +1 -0
- package/data/problems/backspace-string-compare.json +1 -0
- package/data/problems/bag-of-tokens.json +1 -0
- package/data/problems/balanced-binary-tree.json +1 -0
- package/data/problems/base-7.json +1 -0
- package/data/problems/baseball-game.json +1 -0
- package/data/problems/basic-absolute-value.json +1 -0
- package/data/problems/basic-array-max.json +1 -0
- package/data/problems/basic-array-min.json +1 -0
- package/data/problems/basic-array-sum-rec.json +1 -0
- package/data/problems/basic-array-sum.json +1 -0
- package/data/problems/basic-average-floor.json +1 -0
- package/data/problems/basic-bubble-sort.json +1 -0
- package/data/problems/basic-calculator-ii.json +1 -0
- package/data/problems/basic-calculator-iii.json +1 -0
- package/data/problems/basic-calculator-iv.json +1 -0
- package/data/problems/basic-calculator.json +1 -0
- package/data/problems/basic-collatz-steps.json +1 -0
- package/data/problems/basic-contains-value.json +1 -0
- package/data/problems/basic-count-above.json +1 -0
- package/data/problems/basic-count-char.json +1 -0
- package/data/problems/basic-count-digits.json +1 -0
- package/data/problems/basic-count-evens.json +1 -0
- package/data/problems/basic-count-pairs.json +1 -0
- package/data/problems/basic-count-vowels.json +1 -0
- package/data/problems/basic-count-words.json +1 -0
- package/data/problems/basic-countdown.json +1 -0
- package/data/problems/basic-double-array.json +1 -0
- package/data/problems/basic-factorial-rec.json +1 -0
- package/data/problems/basic-factorial.json +1 -0
- package/data/problems/basic-fibonacci.json +1 -0
- package/data/problems/basic-find-index.json +1 -0
- package/data/problems/basic-gcd.json +1 -0
- package/data/problems/basic-grade-letter.json +1 -0
- package/data/problems/basic-has-duplicate.json +1 -0
- package/data/problems/basic-is-even.json +1 -0
- package/data/problems/basic-is-leap-year.json +1 -0
- package/data/problems/basic-is-sorted.json +1 -0
- package/data/problems/basic-max-frequency.json +1 -0
- package/data/problems/basic-max-of-three.json +1 -0
- package/data/problems/basic-max-of-two.json +1 -0
- package/data/problems/basic-palindrome-text.json +1 -0
- package/data/problems/basic-power-rec.json +1 -0
- package/data/problems/basic-power.json +1 -0
- package/data/problems/basic-repeat-string.json +1 -0
- package/data/problems/basic-reverse-array.json +1 -0
- package/data/problems/basic-reverse-number.json +1 -0
- package/data/problems/basic-reverse-text-rec.json +1 -0
- package/data/problems/basic-reverse-text.json +1 -0
- package/data/problems/basic-second-largest.json +1 -0
- package/data/problems/basic-sort-two.json +1 -0
- package/data/problems/basic-staircase.json +1 -0
- package/data/problems/basic-string-length.json +1 -0
- package/data/problems/basic-sum-1-to-n.json +1 -0
- package/data/problems/basic-sum-digits-rec.json +1 -0
- package/data/problems/basic-sum-multiples.json +1 -0
- package/data/problems/basic-sum-of-digits.json +1 -0
- package/data/problems/basic-temperature-advice.json +1 -0
- package/data/problems/basic-to-upper.json +1 -0
- package/data/problems/basic-triangle-sum.json +1 -0
- package/data/problems/battleships-in-a-board.json +1 -0
- package/data/problems/beautiful-arrangement-ii.json +1 -0
- package/data/problems/beautiful-arrangement.json +1 -0
- package/data/problems/beautiful-array.json +1 -0
- package/data/problems/best-meeting-point.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-ii.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-iii.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-iv.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-with-cooldown.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock-with-transaction-fee.json +1 -0
- package/data/problems/best-time-to-buy-and-sell-stock.json +1 -0
- package/data/problems/binary-gap.json +1 -0
- package/data/problems/binary-number-with-alternating-bits.json +1 -0
- package/data/problems/binary-search-tree-iterator.json +1 -0
- package/data/problems/binary-search.json +1 -0
- package/data/problems/binary-subarrays-with-sum.json +1 -0
- package/data/problems/binary-tree-cameras.json +1 -0
- package/data/problems/binary-tree-inorder-traversal.json +1 -0
- package/data/problems/binary-tree-level-order-traversal-ii.json +1 -0
- package/data/problems/binary-tree-level-order-traversal.json +1 -0
- package/data/problems/binary-tree-longest-consecutive-sequence-ii.json +1 -0
- package/data/problems/binary-tree-longest-consecutive-sequence.json +1 -0
- package/data/problems/binary-tree-maximum-path-sum.json +1 -0
- package/data/problems/binary-tree-paths.json +1 -0
- package/data/problems/binary-tree-postorder-traversal.json +1 -0
- package/data/problems/binary-tree-preorder-traversal.json +1 -0
- package/data/problems/binary-tree-pruning.json +1 -0
- package/data/problems/binary-tree-right-side-view.json +1 -0
- package/data/problems/binary-tree-tilt.json +1 -0
- package/data/problems/binary-tree-upside-down.json +1 -0
- package/data/problems/binary-tree-vertical-order-traversal.json +1 -0
- package/data/problems/binary-tree-zigzag-level-order-traversal.json +1 -0
- package/data/problems/binary-trees-with-factors.json +1 -0
- package/data/problems/binary-watch.json +1 -0
- package/data/problems/bitwise-and-of-numbers-range.json +1 -0
- package/data/problems/bitwise-ors-of-subarrays.json +1 -0
- package/data/problems/boats-to-save-people.json +1 -0
- package/data/problems/bold-words-in-string.json +1 -0
- package/data/problems/bomb-enemy.json +1 -0
- package/data/problems/boundary-of-binary-tree.json +1 -0
- package/data/problems/brick-wall.json +1 -0
- package/data/problems/bricks-falling-when-hit.json +1 -0
- package/data/problems/broken-calculator.json +1 -0
- package/data/problems/buddy-strings.json +1 -0
- package/data/problems/build-a-matrix-with-conditions.json +1 -0
- package/data/problems/bulb-switcher-ii.json +1 -0
- package/data/problems/bulb-switcher.json +1 -0
- package/data/problems/bulls-and-cows.json +1 -0
- package/data/problems/burst-balloons.json +1 -0
- package/data/problems/bus-routes.json +1 -0
- package/data/problems/can-i-win.json +1 -0
- package/data/problems/can-place-flowers.json +1 -0
- package/data/problems/candy-crush.json +1 -0
- package/data/problems/candy.json +1 -0
- package/data/problems/capacity-to-ship-packages-within-d-days.json +1 -0
- package/data/problems/car-fleet.json +1 -0
- package/data/problems/car-pooling.json +1 -0
- package/data/problems/card-flipping-game.json +1 -0
- package/data/problems/cat-and-mouse.json +1 -0
- package/data/problems/chalkboard-xor-game.json +1 -0
- package/data/problems/champagne-tower.json +1 -0
- package/data/problems/cheapest-flights-within-k-stops.json +1 -0
- package/data/problems/check-completeness-of-a-binary-tree.json +1 -0
- package/data/problems/cherry-pickup.json +1 -0
- package/data/problems/circular-array-loop.json +1 -0
- package/data/problems/climbing-stairs.json +1 -0
- package/data/problems/clone-graph.json +1 -0
- package/data/problems/closest-binary-search-tree-value-ii.json +1 -0
- package/data/problems/closest-binary-search-tree-value.json +1 -0
- package/data/problems/closest-leaf-in-a-binary-tree.json +1 -0
- package/data/problems/coin-change-ii.json +1 -0
- package/data/problems/coin-change.json +1 -0
- package/data/problems/coin-path.json +1 -0
- package/data/problems/combination-sum-ii.json +1 -0
- package/data/problems/combination-sum-iii.json +1 -0
- package/data/problems/combination-sum-iv.json +1 -0
- package/data/problems/combination-sum.json +1 -0
- package/data/problems/combinations.json +1 -0
- package/data/problems/compare-version-numbers.json +1 -0
- package/data/problems/complete-binary-tree-inserter.json +1 -0
- package/data/problems/complex-number-multiplication.json +1 -0
- package/data/problems/concatenated-words.json +1 -0
- package/data/problems/concatenation-of-array.json +1 -0
- package/data/problems/consecutive-numbers-sum.json +1 -0
- package/data/problems/construct-binary-tree-from-inorder-and-postorder-traversal.json +1 -0
- package/data/problems/construct-binary-tree-from-preorder-and-inorder-traversal.json +1 -0
- package/data/problems/construct-binary-tree-from-preorder-and-postorder-traversal.json +1 -0
- package/data/problems/construct-binary-tree-from-string.json +1 -0
- package/data/problems/construct-quad-tree.json +1 -0
- package/data/problems/construct-string-from-binary-tree.json +1 -0
- package/data/problems/construct-the-rectangle.json +1 -0
- package/data/problems/contain-virus.json +1 -0
- package/data/problems/container-with-most-water.json +1 -0
- package/data/problems/contains-duplicate-ii.json +1 -0
- package/data/problems/contains-duplicate-iii.json +1 -0
- package/data/problems/contains-duplicate.json +1 -0
- package/data/problems/contiguous-array.json +1 -0
- package/data/problems/continuous-subarray-sum.json +1 -0
- package/data/problems/convert-a-number-to-hexadecimal.json +1 -0
- package/data/problems/convert-binary-search-tree-to-sorted-doubly-linked-list.json +1 -0
- package/data/problems/convert-bst-to-greater-tree.json +1 -0
- package/data/problems/convert-sorted-array-to-binary-search-tree.json +1 -0
- package/data/problems/convert-sorted-list-to-binary-search-tree.json +1 -0
- package/data/problems/convex-polygon.json +1 -0
- package/data/problems/copy-list-with-random-pointer.json +1 -0
- package/data/problems/count-and-say.json +1 -0
- package/data/problems/count-binary-substrings.json +1 -0
- package/data/problems/count-complete-tree-nodes.json +1 -0
- package/data/problems/count-different-palindromic-subsequences.json +1 -0
- package/data/problems/count-good-nodes-in-binary-tree.json +1 -0
- package/data/problems/count-numbers-with-unique-digits.json +1 -0
- package/data/problems/count-of-range-sum.json +1 -0
- package/data/problems/count-of-smaller-numbers-after-self.json +1 -0
- package/data/problems/count-primes.json +1 -0
- package/data/problems/count-the-repetitions.json +1 -0
- package/data/problems/count-unique-characters-of-all-substrings-of-a-given-string.json +1 -0
- package/data/problems/count-univalue-subtrees.json +1 -0
- package/data/problems/counting-bits.json +1 -0
- package/data/problems/couples-holding-hands.json +1 -0
- package/data/problems/course-schedule-ii.json +1 -0
- package/data/problems/course-schedule-iii.json +1 -0
- package/data/problems/course-schedule-iv.json +1 -0
- package/data/problems/course-schedule.json +1 -0
- package/data/problems/cousins-in-binary-tree.json +1 -0
- package/data/problems/cracking-the-safe.json +1 -0
- package/data/problems/create-maximum-number.json +1 -0
- package/data/problems/custom-sort-string.json +1 -0
- package/data/problems/cut-off-trees-for-golf-event.json +1 -0
- package/data/problems/daily-temperatures.json +1 -0
- package/data/problems/data-stream-as-disjoint-intervals.json +1 -0
- package/data/problems/decode-string.json +1 -0
- package/data/problems/decode-ways-ii.json +1 -0
- package/data/problems/decode-ways.json +1 -0
- package/data/problems/decoded-string-at-index.json +1 -0
- package/data/problems/degree-of-an-array.json +1 -0
- package/data/problems/delete-and-earn.json +1 -0
- package/data/problems/delete-columns-to-make-sorted-ii.json +1 -0
- package/data/problems/delete-columns-to-make-sorted-iii.json +1 -0
- package/data/problems/delete-columns-to-make-sorted.json +1 -0
- package/data/problems/delete-leaves-with-a-given-value.json +1 -0
- package/data/problems/delete-node-in-a-bst.json +1 -0
- package/data/problems/delete-node-in-a-linked-list.json +1 -0
- package/data/problems/delete-operation-for-two-strings.json +1 -0
- package/data/problems/design-add-and-search-words-data-structure.json +1 -0
- package/data/problems/design-circular-deque.json +1 -0
- package/data/problems/design-circular-queue.json +1 -0
- package/data/problems/design-compressed-string-iterator.json +1 -0
- package/data/problems/design-excel-sum-formula.json +1 -0
- package/data/problems/design-hashmap.json +1 -0
- package/data/problems/design-hashset.json +1 -0
- package/data/problems/design-hit-counter.json +1 -0
- package/data/problems/design-in-memory-file-system.json +1 -0
- package/data/problems/design-linked-list.json +1 -0
- package/data/problems/design-log-storage-system.json +1 -0
- package/data/problems/design-phone-directory.json +1 -0
- package/data/problems/design-search-autocomplete-system.json +1 -0
- package/data/problems/design-snake-game.json +1 -0
- package/data/problems/design-tic-tac-toe.json +1 -0
- package/data/problems/design-twitter.json +1 -0
- package/data/problems/detect-capital.json +1 -0
- package/data/problems/detect-squares.json +1 -0
- package/data/problems/di-string-match.json +1 -0
- package/data/problems/diagonal-traverse.json +1 -0
- package/data/problems/diameter-of-binary-tree.json +1 -0
- package/data/problems/different-ways-to-add-parentheses.json +1 -0
- package/data/problems/distinct-subsequences-ii.json +1 -0
- package/data/problems/distinct-subsequences.json +1 -0
- package/data/problems/distribute-candies.json +1 -0
- package/data/problems/distribute-coins-in-binary-tree.json +1 -0
- package/data/problems/divide-two-integers.json +1 -0
- package/data/problems/domino-and-tromino-tiling.json +1 -0
- package/data/problems/dota2-senate.json +1 -0
- package/data/problems/dungeon-game.json +1 -0
- package/data/problems/edit-distance.json +1 -0
- package/data/problems/elimination-game.json +1 -0
- package/data/problems/employee-free-time.json +1 -0
- package/data/problems/employee-importance.json +1 -0
- package/data/problems/encode-and-decode-strings.json +1 -0
- package/data/problems/encode-and-decode-tinyurl.json +1 -0
- package/data/problems/encode-n-ary-tree-to-binary-tree.json +1 -0
- package/data/problems/encode-string-with-shortest-length.json +1 -0
- package/data/problems/equal-rational-numbers.json +1 -0
- package/data/problems/equal-tree-partition.json +1 -0
- package/data/problems/erect-the-fence.json +1 -0
- package/data/problems/escape-the-ghosts.json +1 -0
- package/data/problems/evaluate-division.json +1 -0
- package/data/problems/evaluate-reverse-polish-notation.json +1 -0
- package/data/problems/exam-room.json +1 -0
- package/data/problems/excel-sheet-column-number.json +1 -0
- package/data/problems/excel-sheet-column-title.json +1 -0
- package/data/problems/exclusive-time-of-functions.json +1 -0
- package/data/problems/expression-add-operators.json +1 -0
- package/data/problems/expressive-words.json +1 -0
- package/data/problems/extra-characters-in-a-string.json +1 -0
- package/data/problems/factor-combinations.json +1 -0
- package/data/problems/factorial-trailing-zeroes.json +1 -0
- package/data/problems/fair-candy-swap.json +1 -0
- package/data/problems/falling-squares.json +1 -0
- package/data/problems/fibonacci-number.json +1 -0
- package/data/problems/find-all-anagrams-in-a-string.json +1 -0
- package/data/problems/find-all-duplicates-in-an-array.json +1 -0
- package/data/problems/find-all-numbers-disappeared-in-an-array.json +1 -0
- package/data/problems/find-anagram-mappings.json +1 -0
- package/data/problems/find-and-replace-in-string.json +1 -0
- package/data/problems/find-and-replace-pattern.json +1 -0
- package/data/problems/find-bottom-left-tree-value.json +1 -0
- package/data/problems/find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree.json +1 -0
- package/data/problems/find-duplicate-file-in-system.json +1 -0
- package/data/problems/find-duplicate-subtrees.json +1 -0
- package/data/problems/find-eventual-safe-states.json +1 -0
- package/data/problems/find-first-and-last-position-of-element-in-sorted-array.json +1 -0
- package/data/problems/find-in-mountain-array.json +1 -0
- package/data/problems/find-k-closest-elements.json +1 -0
- package/data/problems/find-k-pairs-with-smallest-sums.json +1 -0
- package/data/problems/find-k-th-smallest-pair-distance.json +1 -0
- package/data/problems/find-largest-value-in-each-tree-row.json +1 -0
- package/data/problems/find-leaves-of-binary-tree.json +1 -0
- package/data/problems/find-median-from-data-stream.json +1 -0
- package/data/problems/find-minimum-in-rotated-sorted-array-ii.json +1 -0
- package/data/problems/find-minimum-in-rotated-sorted-array.json +1 -0
- package/data/problems/find-mode-in-binary-search-tree.json +1 -0
- package/data/problems/find-peak-element.json +1 -0
- package/data/problems/find-permutation.json +1 -0
- package/data/problems/find-pivot-index.json +1 -0
- package/data/problems/find-right-interval.json +1 -0
- package/data/problems/find-smallest-letter-greater-than-target.json +1 -0
- package/data/problems/find-the-celebrity.json +1 -0
- package/data/problems/find-the-closest-palindrome.json +1 -0
- package/data/problems/find-the-derangement-of-an-array.json +1 -0
- package/data/problems/find-the-difference.json +1 -0
- package/data/problems/find-the-duplicate-number.json +1 -0
- package/data/problems/find-the-index-of-the-first-occurrence-in-a-string.json +1 -0
- package/data/problems/find-the-shortest-superstring.json +1 -0
- package/data/problems/find-the-town-judge.json +1 -0
- package/data/problems/first-bad-version.json +1 -0
- package/data/problems/first-missing-positive.json +1 -0
- package/data/problems/first-unique-character-in-a-string.json +1 -0
- package/data/problems/fizz-buzz.json +1 -0
- package/data/problems/flatten-2d-vector.json +1 -0
- package/data/problems/flatten-a-multilevel-doubly-linked-list.json +1 -0
- package/data/problems/flatten-binary-tree-to-linked-list.json +1 -0
- package/data/problems/flatten-nested-list-iterator.json +1 -0
- package/data/problems/flip-binary-tree-to-match-preorder-traversal.json +1 -0
- package/data/problems/flip-equivalent-binary-trees.json +1 -0
- package/data/problems/flip-game-ii.json +1 -0
- package/data/problems/flip-game.json +1 -0
- package/data/problems/flip-string-to-monotone-increasing.json +1 -0
- package/data/problems/flipping-an-image.json +1 -0
- package/data/problems/flood-fill.json +1 -0
- package/data/problems/fraction-addition-and-subtraction.json +1 -0
- package/data/problems/fraction-to-recurring-decimal.json +1 -0
- package/data/problems/freedom-trail.json +1 -0
- package/data/problems/friends-of-appropriate-ages.json +1 -0
- package/data/problems/frog-jump.json +1 -0
- package/data/problems/fruit-into-baskets.json +1 -0
- package/data/problems/game-of-life.json +1 -0
- package/data/problems/gas-station.json +1 -0
- package/data/problems/generalized-abbreviation.json +1 -0
- package/data/problems/generate-parentheses.json +1 -0
- package/data/problems/generate-random-point-in-a-circle.json +1 -0
- package/data/problems/global-and-local-inversions.json +1 -0
- package/data/problems/goat-latin.json +1 -0
- package/data/problems/graph-valid-tree.json +1 -0
- package/data/problems/gray-code.json +1 -0
- package/data/problems/greatest-common-divisor-of-strings.json +1 -0
- package/data/problems/greatest-common-divisor-traversal.json +1 -0
- package/data/problems/group-anagrams.json +1 -0
- package/data/problems/group-shifted-strings.json +1 -0
- package/data/problems/groups-of-special-equivalent-strings.json +1 -0
- package/data/problems/guess-number-higher-or-lower-ii.json +1 -0
- package/data/problems/guess-number-higher-or-lower.json +1 -0
- package/data/problems/guess-the-word.json +1 -0
- package/data/problems/h-index-ii.json +1 -0
- package/data/problems/h-index.json +1 -0
- package/data/problems/hamming-distance.json +1 -0
- package/data/problems/hand-of-straights.json +1 -0
- package/data/problems/happy-number.json +1 -0
- package/data/problems/heaters.json +1 -0
- package/data/problems/house-robber-ii.json +1 -0
- package/data/problems/house-robber-iii.json +1 -0
- package/data/problems/house-robber.json +1 -0
- package/data/problems/image-overlap.json +1 -0
- package/data/problems/image-smoother.json +1 -0
- package/data/problems/implement-magic-dictionary.json +1 -0
- package/data/problems/implement-queue-using-stacks.json +1 -0
- package/data/problems/implement-rand10-using-rand7.json +1 -0
- package/data/problems/implement-stack-using-queues.json +1 -0
- package/data/problems/implement-trie-prefix-tree.json +1 -0
- package/data/problems/increasing-order-search-tree.json +1 -0
- package/data/problems/increasing-triplet-subsequence.json +1 -0
- package/data/problems/inorder-successor-in-bst-ii.json +1 -0
- package/data/problems/inorder-successor-in-bst.json +1 -0
- package/data/problems/insert-delete-getrandom-o1-duplicates-allowed.json +1 -0
- package/data/problems/insert-delete-getrandom-o1.json +1 -0
- package/data/problems/insert-greatest-common-divisors-in-linked-list.json +1 -0
- package/data/problems/insert-interval.json +1 -0
- package/data/problems/insert-into-a-binary-search-tree.json +1 -0
- package/data/problems/insert-into-a-sorted-circular-linked-list.json +1 -0
- package/data/problems/insertion-sort-list.json +1 -0
- package/data/problems/integer-break.json +1 -0
- package/data/problems/integer-replacement.json +1 -0
- package/data/problems/integer-to-english-words.json +1 -0
- package/data/problems/integer-to-roman.json +1 -0
- package/data/problems/interleaving-string.json +1 -0
- package/data/problems/intersection-of-two-arrays-ii.json +1 -0
- package/data/problems/intersection-of-two-arrays.json +1 -0
- package/data/problems/intersection-of-two-linked-lists.json +1 -0
- package/data/problems/interval-list-intersections.json +1 -0
- package/data/problems/invert-binary-tree.json +1 -0
- package/data/problems/ip-to-cidr.json +1 -0
- package/data/problems/ipo.json +1 -0
- package/data/problems/is-graph-bipartite.json +1 -0
- package/data/problems/is-subsequence.json +1 -0
- package/data/problems/island-perimeter.json +1 -0
- package/data/problems/isomorphic-strings.json +1 -0
- package/data/problems/jewels-and-stones.json +1 -0
- package/data/problems/jump-game-ii.json +1 -0
- package/data/problems/jump-game-vii.json +1 -0
- package/data/problems/jump-game.json +1 -0
- package/data/problems/k-closest-points-to-origin.json +1 -0
- package/data/problems/k-diff-pairs-in-an-array.json +1 -0
- package/data/problems/k-empty-slots.json +1 -0
- package/data/problems/k-inverse-pairs-array.json +1 -0
- package/data/problems/k-similar-strings.json +1 -0
- package/data/problems/k-th-smallest-in-lexicographical-order.json +1 -0
- package/data/problems/k-th-smallest-prime-fraction.json +1 -0
- package/data/problems/k-th-symbol-in-grammar.json +1 -0
- package/data/problems/keyboard-row.json +1 -0
- package/data/problems/keys-and-rooms.json +1 -0
- package/data/problems/kill-process.json +1 -0
- package/data/problems/knight-dialer.json +1 -0
- package/data/problems/knight-probability-in-chessboard.json +1 -0
- package/data/problems/koko-eating-bananas.json +1 -0
- package/data/problems/kth-largest-element-in-a-stream.json +1 -0
- package/data/problems/kth-largest-element-in-an-array.json +1 -0
- package/data/problems/kth-smallest-element-in-a-bst.json +1 -0
- package/data/problems/kth-smallest-element-in-a-sorted-matrix.json +1 -0
- package/data/problems/kth-smallest-number-in-multiplication-table.json +1 -0
- package/data/problems/largest-bst-subtree.json +1 -0
- package/data/problems/largest-component-size-by-common-factor.json +1 -0
- package/data/problems/largest-divisible-subset.json +1 -0
- package/data/problems/largest-number-at-least-twice-of-others.json +1 -0
- package/data/problems/largest-number.json +1 -0
- package/data/problems/largest-palindrome-product.json +1 -0
- package/data/problems/largest-perimeter-triangle.json +1 -0
- package/data/problems/largest-plus-sign.json +1 -0
- package/data/problems/largest-rectangle-in-histogram.json +1 -0
- package/data/problems/largest-sum-of-averages.json +1 -0
- package/data/problems/largest-time-for-given-digits.json +1 -0
- package/data/problems/largest-triangle-area.json +1 -0
- package/data/problems/last-stone-weight-ii.json +1 -0
- package/data/problems/last-stone-weight.json +1 -0
- package/data/problems/leaf-similar-trees.json +1 -0
- package/data/problems/least-operators-to-express-number.json +1 -0
- package/data/problems/lemonade-change.json +1 -0
- package/data/problems/length-of-last-word.json +1 -0
- package/data/problems/length-of-longest-fibonacci-subsequence.json +1 -0
- package/data/problems/letter-case-permutation.json +1 -0
- package/data/problems/letter-combinations-of-a-phone-number.json +1 -0
- package/data/problems/lexicographical-numbers.json +1 -0
- package/data/problems/lfu-cache.json +1 -0
- package/data/problems/license-key-formatting.json +1 -0
- package/data/problems/line-reflection.json +1 -0
- package/data/problems/linked-list-components.json +1 -0
- package/data/problems/linked-list-cycle-ii.json +1 -0
- package/data/problems/linked-list-cycle.json +1 -0
- package/data/problems/linked-list-random-node.json +1 -0
- package/data/problems/logger-rate-limiter.json +1 -0
- package/data/problems/logical-or-of-two-binary-grids-represented-as-quad-trees.json +1 -0
- package/data/problems/lonely-pixel-i.json +1 -0
- package/data/problems/lonely-pixel-ii.json +1 -0
- package/data/problems/long-pressed-name.json +1 -0
- package/data/problems/longest-absolute-file-path.json +1 -0
- package/data/problems/longest-common-prefix.json +1 -0
- package/data/problems/longest-common-subsequence.json +1 -0
- package/data/problems/longest-consecutive-sequence.json +1 -0
- package/data/problems/longest-continuous-increasing-subsequence.json +1 -0
- package/data/problems/longest-happy-string.json +1 -0
- package/data/problems/longest-harmonious-subsequence.json +1 -0
- package/data/problems/longest-increasing-path-in-a-matrix.json +1 -0
- package/data/problems/longest-increasing-subsequence.json +1 -0
- package/data/problems/longest-line-of-consecutive-one-in-matrix.json +1 -0
- package/data/problems/longest-mountain-in-array.json +1 -0
- package/data/problems/longest-palindrome.json +1 -0
- package/data/problems/longest-palindromic-subsequence.json +1 -0
- package/data/problems/longest-palindromic-substring.json +1 -0
- package/data/problems/longest-repeating-character-replacement.json +1 -0
- package/data/problems/longest-substring-with-at-least-k-repeating-characters.json +1 -0
- package/data/problems/longest-substring-with-at-most-k-distinct-characters.json +1 -0
- package/data/problems/longest-substring-with-at-most-two-distinct-characters.json +1 -0
- package/data/problems/longest-substring-without-repeating-characters.json +1 -0
- package/data/problems/longest-turbulent-subarray.json +1 -0
- package/data/problems/longest-uncommon-subsequence-i.json +1 -0
- package/data/problems/longest-uncommon-subsequence-ii.json +1 -0
- package/data/problems/longest-univalue-path.json +1 -0
- package/data/problems/longest-valid-parentheses.json +1 -0
- package/data/problems/longest-word-in-dictionary-through-deleting.json +1 -0
- package/data/problems/longest-word-in-dictionary.json +1 -0
- package/data/problems/loud-and-rich.json +1 -0
- package/data/problems/lowest-common-ancestor-of-a-binary-search-tree.json +1 -0
- package/data/problems/lowest-common-ancestor-of-a-binary-tree.json +1 -0
- package/data/problems/lru-cache.json +1 -0
- package/data/problems/magic-squares-in-grid.json +1 -0
- package/data/problems/magical-string.json +1 -0
- package/data/problems/majority-element-ii.json +1 -0
- package/data/problems/majority-element.json +1 -0
- package/data/problems/making-a-large-island.json +1 -0
- package/data/problems/map-sum-pairs.json +1 -0
- package/data/problems/masking-personal-information.json +1 -0
- package/data/problems/matchsticks-to-square.json +1 -0
- package/data/problems/max-area-of-island.json +1 -0
- package/data/problems/max-chunks-to-make-sorted-ii.json +1 -0
- package/data/problems/max-chunks-to-make-sorted.json +1 -0
- package/data/problems/max-consecutive-ones-ii.json +1 -0
- package/data/problems/max-consecutive-ones.json +1 -0
- package/data/problems/max-increase-to-keep-city-skyline.json +1 -0
- package/data/problems/max-points-on-a-line.json +1 -0
- package/data/problems/max-stack.json +1 -0
- package/data/problems/max-sum-of-rectangle-no-larger-than-k.json +1 -0
- package/data/problems/maximal-rectangle.json +1 -0
- package/data/problems/maximal-square.json +1 -0
- package/data/problems/maximize-distance-to-closest-person.json +1 -0
- package/data/problems/maximum-average-subarray-i.json +1 -0
- package/data/problems/maximum-average-subarray-ii.json +1 -0
- package/data/problems/maximum-binary-tree-ii.json +1 -0
- package/data/problems/maximum-binary-tree.json +1 -0
- package/data/problems/maximum-depth-of-binary-tree.json +1 -0
- package/data/problems/maximum-depth-of-n-ary-tree.json +1 -0
- package/data/problems/maximum-distance-in-arrays.json +1 -0
- package/data/problems/maximum-frequency-stack.json +1 -0
- package/data/problems/maximum-gap.json +1 -0
- package/data/problems/maximum-length-of-pair-chain.json +1 -0
- package/data/problems/maximum-length-of-repeated-subarray.json +1 -0
- package/data/problems/maximum-product-of-three-numbers.json +1 -0
- package/data/problems/maximum-product-of-word-lengths.json +1 -0
- package/data/problems/maximum-product-subarray.json +1 -0
- package/data/problems/maximum-size-subarray-sum-equals-k.json +1 -0
- package/data/problems/maximum-subarray.json +1 -0
- package/data/problems/maximum-sum-circular-subarray.json +1 -0
- package/data/problems/maximum-sum-of-3-non-overlapping-subarrays.json +1 -0
- package/data/problems/maximum-swap.json +1 -0
- package/data/problems/maximum-vacation-days.json +1 -0
- package/data/problems/maximum-width-of-binary-tree.json +1 -0
- package/data/problems/maximum-width-ramp.json +1 -0
- package/data/problems/maximum-xor-of-two-numbers-in-an-array.json +1 -0
- package/data/problems/median-of-two-sorted-arrays.json +1 -0
- package/data/problems/meeting-rooms-ii.json +1 -0
- package/data/problems/meeting-rooms-iii.json +1 -0
- package/data/problems/meeting-rooms.json +1 -0
- package/data/problems/merge-intervals.json +1 -0
- package/data/problems/merge-k-sorted-lists.json +1 -0
- package/data/problems/merge-sorted-array.json +1 -0
- package/data/problems/merge-strings-alternately.json +1 -0
- package/data/problems/merge-triplets-to-form-target-triplet.json +1 -0
- package/data/problems/merge-two-binary-trees.json +1 -0
- package/data/problems/merge-two-sorted-lists.json +1 -0
- package/data/problems/middle-of-the-linked-list.json +1 -0
- package/data/problems/min-cost-climbing-stairs.json +1 -0
- package/data/problems/min-cost-to-connect-all-points.json +1 -0
- package/data/problems/min-stack.json +1 -0
- package/data/problems/minesweeper.json +1 -0
- package/data/problems/mini-parser.json +1 -0
- package/data/problems/minimize-malware-spread-ii.json +1 -0
- package/data/problems/minimize-malware-spread.json +1 -0
- package/data/problems/minimize-max-distance-to-gas-station.json +1 -0
- package/data/problems/minimum-absolute-difference-in-bst.json +1 -0
- package/data/problems/minimum-add-to-make-parentheses-valid.json +1 -0
- package/data/problems/minimum-area-rectangle-ii.json +1 -0
- package/data/problems/minimum-area-rectangle.json +1 -0
- package/data/problems/minimum-array-end.json +1 -0
- package/data/problems/minimum-ascii-delete-sum-for-two-strings.json +1 -0
- package/data/problems/minimum-cost-for-tickets.json +1 -0
- package/data/problems/minimum-cost-to-hire-k-workers.json +1 -0
- package/data/problems/minimum-cost-to-merge-stones.json +1 -0
- package/data/problems/minimum-depth-of-binary-tree.json +1 -0
- package/data/problems/minimum-distance-between-bst-nodes.json +1 -0
- package/data/problems/minimum-factorization.json +1 -0
- package/data/problems/minimum-falling-path-sum.json +1 -0
- package/data/problems/minimum-genetic-mutation.json +1 -0
- package/data/problems/minimum-height-trees.json +1 -0
- package/data/problems/minimum-increment-to-make-array-unique.json +1 -0
- package/data/problems/minimum-index-sum-of-two-lists.json +1 -0
- package/data/problems/minimum-interval-to-include-each-query.json +1 -0
- package/data/problems/minimum-moves-to-equal-array-elements-ii.json +1 -0
- package/data/problems/minimum-moves-to-equal-array-elements.json +1 -0
- package/data/problems/minimum-number-of-arrows-to-burst-balloons.json +1 -0
- package/data/problems/minimum-number-of-k-consecutive-bit-flips.json +1 -0
- package/data/problems/minimum-number-of-refueling-stops.json +1 -0
- package/data/problems/minimum-path-sum.json +1 -0
- package/data/problems/minimum-size-subarray-sum.json +1 -0
- package/data/problems/minimum-swaps-to-make-sequences-increasing.json +1 -0
- package/data/problems/minimum-time-difference.json +1 -0
- package/data/problems/minimum-unique-word-abbreviation.json +1 -0
- package/data/problems/minimum-window-subsequence.json +1 -0
- package/data/problems/minimum-window-substring.json +1 -0
- package/data/problems/mirror-reflection.json +1 -0
- package/data/problems/missing-number.json +1 -0
- package/data/problems/missing-ranges.json +1 -0
- package/data/problems/monotone-increasing-digits.json +1 -0
- package/data/problems/monotonic-array.json +1 -0
- package/data/problems/most-common-word.json +1 -0
- package/data/problems/most-frequent-subtree-sum.json +1 -0
- package/data/problems/most-profit-assigning-work.json +1 -0
- package/data/problems/most-stones-removed-with-same-row-or-column.json +1 -0
- package/data/problems/move-zeroes.json +1 -0
- package/data/problems/moving-average-from-data-stream.json +1 -0
- package/data/problems/multiply-strings.json +1 -0
- package/data/problems/my-calendar-i.json +1 -0
- package/data/problems/my-calendar-ii.json +1 -0
- package/data/problems/my-calendar-iii.json +1 -0
- package/data/problems/n-ary-tree-level-order-traversal.json +1 -0
- package/data/problems/n-ary-tree-postorder-traversal.json +1 -0
- package/data/problems/n-ary-tree-preorder-traversal.json +1 -0
- package/data/problems/n-queens-ii.json +1 -0
- package/data/problems/n-queens.json +1 -0
- package/data/problems/n-repeated-element-in-size-2n-array.json +1 -0
- package/data/problems/n-th-tribonacci-number.json +1 -0
- package/data/problems/nested-list-weight-sum-ii.json +1 -0
- package/data/problems/nested-list-weight-sum.json +1 -0
- package/data/problems/network-delay-time.json +1 -0
- package/data/problems/new-21-game.json +1 -0
- package/data/problems/next-closest-time.json +1 -0
- package/data/problems/next-greater-element-i.json +1 -0
- package/data/problems/next-greater-element-ii.json +1 -0
- package/data/problems/next-greater-element-iii.json +1 -0
- package/data/problems/next-permutation.json +1 -0
- package/data/problems/nim-game.json +1 -0
- package/data/problems/non-decreasing-array.json +1 -0
- package/data/problems/non-decreasing-subsequences.json +1 -0
- package/data/problems/non-negative-integers-without-consecutive-ones.json +1 -0
- package/data/problems/non-overlapping-intervals.json +1 -0
- package/data/problems/nth-digit.json +1 -0
- package/data/problems/nth-magical-number.json +1 -0
- package/data/problems/number-complement.json +1 -0
- package/data/problems/number-of-1-bits.json +1 -0
- package/data/problems/number-of-atoms.json +1 -0
- package/data/problems/number-of-boomerangs.json +1 -0
- package/data/problems/number-of-connected-components-in-an-undirected-graph.json +1 -0
- package/data/problems/number-of-corner-rectangles.json +1 -0
- package/data/problems/number-of-digit-one.json +1 -0
- package/data/problems/number-of-distinct-islands-ii.json +1 -0
- package/data/problems/number-of-distinct-islands.json +1 -0
- package/data/problems/number-of-islands-ii.json +1 -0
- package/data/problems/number-of-islands.json +1 -0
- package/data/problems/number-of-lines-to-write-string.json +1 -0
- package/data/problems/number-of-longest-increasing-subsequence.json +1 -0
- package/data/problems/number-of-matching-subsequences.json +1 -0
- package/data/problems/number-of-music-playlists.json +1 -0
- package/data/problems/number-of-provinces.json +1 -0
- package/data/problems/number-of-recent-calls.json +1 -0
- package/data/problems/number-of-segments-in-a-string.json +1 -0
- package/data/problems/number-of-squareful-arrays.json +1 -0
- package/data/problems/number-of-subarrays-with-bounded-maximum.json +1 -0
- package/data/problems/numbers-at-most-n-given-digit-set.json +1 -0
- package/data/problems/numbers-with-same-consecutive-differences.json +1 -0
- package/data/problems/odd-even-jump.json +1 -0
- package/data/problems/odd-even-linked-list.json +1 -0
- package/data/problems/one-edit-distance.json +1 -0
- package/data/problems/ones-and-zeroes.json +1 -0
- package/data/problems/online-election.json +1 -0
- package/data/problems/online-stock-span.json +1 -0
- package/data/problems/open-the-lock.json +1 -0
- package/data/problems/optimal-account-balancing.json +1 -0
- package/data/problems/optimal-division.json +1 -0
- package/data/problems/orderly-queue.json +1 -0
- package/data/problems/out-of-boundary-paths.json +1 -0
- package/data/problems/output-contest-matches.json +1 -0
- package/data/problems/pacific-atlantic-water-flow.json +1 -0
- package/data/problems/paint-fence.json +1 -0
- package/data/problems/paint-house-ii.json +1 -0
- package/data/problems/paint-house.json +1 -0
- package/data/problems/palindrome-linked-list.json +1 -0
- package/data/problems/palindrome-number.json +1 -0
- package/data/problems/palindrome-pairs.json +1 -0
- package/data/problems/palindrome-partitioning-ii.json +1 -0
- package/data/problems/palindrome-partitioning.json +1 -0
- package/data/problems/palindrome-permutation-ii.json +1 -0
- package/data/problems/palindrome-permutation.json +1 -0
- package/data/problems/palindromic-substrings.json +1 -0
- package/data/problems/pancake-sorting.json +1 -0
- package/data/problems/parse-lisp-expression.json +1 -0
- package/data/problems/partition-array-into-disjoint-intervals.json +1 -0
- package/data/problems/partition-equal-subset-sum.json +1 -0
- package/data/problems/partition-labels.json +1 -0
- package/data/problems/partition-list.json +1 -0
- package/data/problems/partition-to-k-equal-sum-subsets.json +1 -0
- package/data/problems/pascals-triangle-ii.json +1 -0
- package/data/problems/pascals-triangle.json +1 -0
- package/data/problems/patching-array.json +1 -0
- package/data/problems/path-sum-ii.json +1 -0
- package/data/problems/path-sum-iii.json +1 -0
- package/data/problems/path-sum-iv.json +1 -0
- package/data/problems/path-sum.json +1 -0
- package/data/problems/path-with-minimum-effort.json +1 -0
- package/data/problems/peak-index-in-a-mountain-array.json +1 -0
- package/data/problems/peeking-iterator.json +1 -0
- package/data/problems/perfect-number.json +1 -0
- package/data/problems/perfect-rectangle.json +1 -0
- package/data/problems/perfect-squares.json +1 -0
- package/data/problems/permutation-in-string.json +1 -0
- package/data/problems/permutation-sequence.json +1 -0
- package/data/problems/permutations-ii.json +1 -0
- package/data/problems/permutations.json +1 -0
- package/data/problems/plus-one-linked-list.json +1 -0
- package/data/problems/plus-one.json +1 -0
- package/data/problems/poor-pigs.json +1 -0
- package/data/problems/populating-next-right-pointers-in-each-node-ii.json +1 -0
- package/data/problems/populating-next-right-pointers-in-each-node.json +1 -0
- package/data/problems/positions-of-large-groups.json +1 -0
- package/data/problems/possible-bipartition.json +1 -0
- package/data/problems/pour-water.json +1 -0
- package/data/problems/power-of-four.json +1 -0
- package/data/problems/power-of-three.json +1 -0
- package/data/problems/power-of-two.json +1 -0
- package/data/problems/powerful-integers.json +1 -0
- package/data/problems/powx-n.json +1 -0
- package/data/problems/predict-the-winner.json +1 -0
- package/data/problems/prefix-and-suffix-search.json +1 -0
- package/data/problems/preimage-size-of-factorial-zeroes-function.json +1 -0
- package/data/problems/prime-number-of-set-bits-in-binary-representation.json +1 -0
- package/data/problems/prime-palindrome.json +1 -0
- package/data/problems/print-binary-tree.json +1 -0
- package/data/problems/prison-cells-after-n-days.json +1 -0
- package/data/problems/product-of-array-except-self.json +1 -0
- package/data/problems/profitable-schemes.json +1 -0
- package/data/problems/projection-area-of-3d-shapes.json +1 -0
- package/data/problems/push-dominoes.json +1 -0
- package/data/problems/pyramid-transition-matrix.json +1 -0
- package/data/problems/queue-reconstruction-by-height.json +1 -0
- package/data/problems/rabbits-in-forest.json +1 -0
- package/data/problems/race-car.json +1 -0
- package/data/problems/random-flip-matrix.json +1 -0
- package/data/problems/random-pick-index.json +1 -0
- package/data/problems/random-pick-with-blacklist.json +1 -0
- package/data/problems/random-pick-with-weight.json +1 -0
- package/data/problems/random-point-in-non-overlapping-rectangles.json +1 -0
- package/data/problems/range-addition-ii.json +1 -0
- package/data/problems/range-addition.json +1 -0
- package/data/problems/range-module.json +1 -0
- package/data/problems/range-sum-of-bst.json +1 -0
- package/data/problems/range-sum-query-2d-immutable.json +1 -0
- package/data/problems/range-sum-query-2d-mutable.json +1 -0
- package/data/problems/range-sum-query-immutable.json +1 -0
- package/data/problems/range-sum-query-mutable.json +1 -0
- package/data/problems/ransom-note.json +1 -0
- package/data/problems/reach-a-number.json +1 -0
- package/data/problems/reachable-nodes-in-subdivided-graph.json +1 -0
- package/data/problems/reaching-points.json +1 -0
- package/data/problems/read-n-characters-given-read4-ii-call-multiple-times.json +1 -0
- package/data/problems/read-n-characters-given-read4.json +1 -0
- package/data/problems/rearrange-string-k-distance-apart.json +1 -0
- package/data/problems/reconstruct-itinerary.json +1 -0
- package/data/problems/reconstruct-original-digits-from-english.json +1 -0
- package/data/problems/recover-binary-search-tree.json +1 -0
- package/data/problems/rectangle-area-ii.json +1 -0
- package/data/problems/rectangle-area.json +1 -0
- package/data/problems/rectangle-overlap.json +1 -0
- package/data/problems/redundant-connection-ii.json +1 -0
- package/data/problems/redundant-connection.json +1 -0
- package/data/problems/regions-cut-by-slashes.json +1 -0
- package/data/problems/regular-expression-matching.json +1 -0
- package/data/problems/relative-ranks.json +1 -0
- package/data/problems/remove-9.json +1 -0
- package/data/problems/remove-boxes.json +1 -0
- package/data/problems/remove-comments.json +1 -0
- package/data/problems/remove-duplicate-letters.json +1 -0
- package/data/problems/remove-duplicates-from-sorted-array-ii.json +1 -0
- package/data/problems/remove-duplicates-from-sorted-array.json +1 -0
- package/data/problems/remove-duplicates-from-sorted-list-ii.json +1 -0
- package/data/problems/remove-duplicates-from-sorted-list.json +1 -0
- package/data/problems/remove-element.json +1 -0
- package/data/problems/remove-invalid-parentheses.json +1 -0
- package/data/problems/remove-k-digits.json +1 -0
- package/data/problems/remove-linked-list-elements.json +1 -0
- package/data/problems/remove-nth-node-from-end-of-list.json +1 -0
- package/data/problems/reorder-data-in-log-files.json +1 -0
- package/data/problems/reorder-list.json +1 -0
- package/data/problems/reordered-power-of-2.json +1 -0
- package/data/problems/reorganize-string.json +1 -0
- package/data/problems/repeated-dna-sequences.json +1 -0
- package/data/problems/repeated-string-match.json +1 -0
- package/data/problems/repeated-substring-pattern.json +1 -0
- package/data/problems/replace-words.json +1 -0
- package/data/problems/reshape-the-matrix.json +1 -0
- package/data/problems/restore-ip-addresses.json +1 -0
- package/data/problems/reveal-cards-in-increasing-order.json +1 -0
- package/data/problems/reverse-bits.json +1 -0
- package/data/problems/reverse-integer.json +1 -0
- package/data/problems/reverse-linked-list-ii.json +1 -0
- package/data/problems/reverse-linked-list.json +1 -0
- package/data/problems/reverse-nodes-in-k-group.json +1 -0
- package/data/problems/reverse-only-letters.json +1 -0
- package/data/problems/reverse-pairs.json +1 -0
- package/data/problems/reverse-string-ii.json +1 -0
- package/data/problems/reverse-string.json +1 -0
- package/data/problems/reverse-vowels-of-a-string.json +1 -0
- package/data/problems/reverse-words-in-a-string-ii.json +1 -0
- package/data/problems/reverse-words-in-a-string-iii.json +1 -0
- package/data/problems/reverse-words-in-a-string.json +1 -0
- package/data/problems/rle-iterator.json +1 -0
- package/data/problems/robot-return-to-origin.json +1 -0
- package/data/problems/robot-room-cleaner.json +1 -0
- package/data/problems/roman-to-integer.json +1 -0
- package/data/problems/rotate-array.json +1 -0
- package/data/problems/rotate-function.json +1 -0
- package/data/problems/rotate-image.json +1 -0
- package/data/problems/rotate-list.json +1 -0
- package/data/problems/rotate-string.json +1 -0
- package/data/problems/rotated-digits.json +1 -0
- package/data/problems/rotting-oranges.json +1 -0
- package/data/problems/russian-doll-envelopes.json +1 -0
- package/data/problems/same-tree.json +1 -0
- package/data/problems/satisfiability-of-equality-equations.json +1 -0
- package/data/problems/score-after-flipping-matrix.json +1 -0
- package/data/problems/score-of-parentheses.json +1 -0
- package/data/problems/scramble-string.json +1 -0
- package/data/problems/search-a-2d-matrix-ii.json +1 -0
- package/data/problems/search-a-2d-matrix.json +1 -0
- package/data/problems/search-in-a-binary-search-tree.json +1 -0
- package/data/problems/search-in-a-sorted-array-of-unknown-size.json +1 -0
- package/data/problems/search-in-rotated-sorted-array-ii.json +1 -0
- package/data/problems/search-in-rotated-sorted-array.json +1 -0
- package/data/problems/search-insert-position.json +1 -0
- package/data/problems/second-minimum-node-in-a-binary-tree.json +1 -0
- package/data/problems/self-crossing.json +1 -0
- package/data/problems/self-dividing-numbers.json +1 -0
- package/data/problems/sentence-screen-fitting.json +1 -0
- package/data/problems/sentence-similarity-ii.json +1 -0
- package/data/problems/sentence-similarity.json +1 -0
- package/data/problems/sequence-reconstruction.json +1 -0
- package/data/problems/serialize-and-deserialize-binary-tree.json +1 -0
- package/data/problems/serialize-and-deserialize-bst.json +1 -0
- package/data/problems/serialize-and-deserialize-n-ary-tree.json +1 -0
- package/data/problems/set-intersection-size-at-least-two.json +1 -0
- package/data/problems/set-matrix-zeroes.json +1 -0
- package/data/problems/set-mismatch.json +1 -0
- package/data/problems/shifting-letters.json +1 -0
- package/data/problems/shopping-offers.json +1 -0
- package/data/problems/short-encoding-of-words.json +1 -0
- package/data/problems/shortest-bridge.json +1 -0
- package/data/problems/shortest-completing-word.json +1 -0
- package/data/problems/shortest-distance-from-all-buildings.json +1 -0
- package/data/problems/shortest-distance-to-a-character.json +1 -0
- package/data/problems/shortest-palindrome.json +1 -0
- package/data/problems/shortest-path-to-get-all-keys.json +1 -0
- package/data/problems/shortest-path-visiting-all-nodes.json +1 -0
- package/data/problems/shortest-subarray-with-sum-at-least-k.json +1 -0
- package/data/problems/shortest-unsorted-continuous-subarray.json +1 -0
- package/data/problems/shortest-word-distance-ii.json +1 -0
- package/data/problems/shortest-word-distance-iii.json +1 -0
- package/data/problems/shortest-word-distance.json +1 -0
- package/data/problems/shuffle-an-array.json +1 -0
- package/data/problems/similar-rgb-color.json +1 -0
- package/data/problems/similar-string-groups.json +1 -0
- package/data/problems/simplify-path.json +1 -0
- package/data/problems/single-element-in-a-sorted-array.json +1 -0
- package/data/problems/single-number-ii.json +1 -0
- package/data/problems/single-number-iii.json +1 -0
- package/data/problems/single-number.json +1 -0
- package/data/problems/single-threaded-cpu.json +1 -0
- package/data/problems/sliding-puzzle.json +1 -0
- package/data/problems/sliding-window-maximum.json +1 -0
- package/data/problems/sliding-window-median.json +1 -0
- package/data/problems/smallest-good-base.json +1 -0
- package/data/problems/smallest-range-covering-elements-from-k-lists.json +1 -0
- package/data/problems/smallest-range-i.json +1 -0
- package/data/problems/smallest-range-ii.json +1 -0
- package/data/problems/smallest-rectangle-enclosing-black-pixels.json +1 -0
- package/data/problems/smallest-rotation-with-highest-score.json +1 -0
- package/data/problems/smallest-string-starting-from-leaf.json +1 -0
- package/data/problems/smallest-subtree-with-all-the-deepest-nodes.json +1 -0
- package/data/problems/snakes-and-ladders.json +1 -0
- package/data/problems/solve-the-equation.json +1 -0
- package/data/problems/sort-an-array.json +1 -0
- package/data/problems/sort-array-by-parity-ii.json +1 -0
- package/data/problems/sort-array-by-parity.json +1 -0
- package/data/problems/sort-characters-by-frequency.json +1 -0
- package/data/problems/sort-colors.json +1 -0
- package/data/problems/sort-list.json +1 -0
- package/data/problems/sort-transformed-array.json +1 -0
- package/data/problems/soup-servings.json +1 -0
- package/data/problems/sparse-matrix-multiplication.json +1 -0
- package/data/problems/special-binary-string.json +1 -0
- package/data/problems/spiral-matrix-ii.json +1 -0
- package/data/problems/spiral-matrix-iii.json +1 -0
- package/data/problems/spiral-matrix.json +1 -0
- package/data/problems/split-array-into-consecutive-subsequences.json +1 -0
- package/data/problems/split-array-into-fibonacci-sequence.json +1 -0
- package/data/problems/split-array-largest-sum.json +1 -0
- package/data/problems/split-array-with-equal-sum.json +1 -0
- package/data/problems/split-array-with-same-average.json +1 -0
- package/data/problems/split-bst.json +1 -0
- package/data/problems/split-concatenated-strings.json +1 -0
- package/data/problems/split-linked-list-in-parts.json +1 -0
- package/data/problems/sqrtx.json +1 -0
- package/data/problems/squares-of-a-sorted-array.json +1 -0
- package/data/problems/squirrel-simulation.json +1 -0
- package/data/problems/stamping-the-sequence.json +1 -0
- package/data/problems/stickers-to-spell-word.json +1 -0
- package/data/problems/stone-game-ii.json +1 -0
- package/data/problems/stone-game-iii.json +1 -0
- package/data/problems/stone-game.json +1 -0
- package/data/problems/strange-printer.json +1 -0
- package/data/problems/string-compression.json +1 -0
- package/data/problems/string-to-integer-atoi.json +1 -0
- package/data/problems/string-without-aaa-or-bbb.json +1 -0
- package/data/problems/strobogrammatic-number-ii.json +1 -0
- package/data/problems/strobogrammatic-number-iii.json +1 -0
- package/data/problems/strobogrammatic-number.json +1 -0
- package/data/problems/strong-password-checker.json +1 -0
- package/data/problems/student-attendance-record-i.json +1 -0
- package/data/problems/student-attendance-record-ii.json +1 -0
- package/data/problems/subarray-product-less-than-k.json +1 -0
- package/data/problems/subarray-sum-equals-k.json +1 -0
- package/data/problems/subarray-sums-divisible-by-k.json +1 -0
- package/data/problems/subarrays-with-k-different-integers.json +1 -0
- package/data/problems/subdomain-visit-count.json +1 -0
- package/data/problems/subsets-ii.json +1 -0
- package/data/problems/subsets.json +1 -0
- package/data/problems/substring-with-concatenation-of-all-words.json +1 -0
- package/data/problems/subtree-of-another-tree.json +1 -0
- package/data/problems/sudoku-solver.json +1 -0
- package/data/problems/sum-of-all-subset-xor-totals.json +1 -0
- package/data/problems/sum-of-distances-in-tree.json +1 -0
- package/data/problems/sum-of-even-numbers-after-queries.json +1 -0
- package/data/problems/sum-of-left-leaves.json +1 -0
- package/data/problems/sum-of-square-numbers.json +1 -0
- package/data/problems/sum-of-subarray-minimums.json +1 -0
- package/data/problems/sum-of-subsequence-widths.json +1 -0
- package/data/problems/sum-of-two-integers.json +1 -0
- package/data/problems/sum-root-to-leaf-numbers.json +1 -0
- package/data/problems/summary-ranges.json +1 -0
- package/data/problems/super-egg-drop.json +1 -0
- package/data/problems/super-palindromes.json +1 -0
- package/data/problems/super-pow.json +1 -0
- package/data/problems/super-ugly-number.json +1 -0
- package/data/problems/super-washing-machines.json +1 -0
- package/data/problems/surface-area-of-3d-shapes.json +1 -0
- package/data/problems/surrounded-regions.json +1 -0
- package/data/problems/swap-adjacent-in-lr-string.json +1 -0
- package/data/problems/swap-nodes-in-pairs.json +1 -0
- package/data/problems/swim-in-rising-water.json +1 -0
- package/data/problems/symmetric-tree.json +1 -0
- package/data/problems/tag-validator.json +1 -0
- package/data/problems/tallest-billboard.json +1 -0
- package/data/problems/target-sum.json +1 -0
- package/data/problems/task-scheduler.json +1 -0
- package/data/problems/teemo-attacking.json +1 -0
- package/data/problems/ternary-expression-parser.json +1 -0
- package/data/problems/text-justification.json +1 -0
- package/data/problems/the-maze-ii.json +1 -0
- package/data/problems/the-maze-iii.json +1 -0
- package/data/problems/the-maze.json +1 -0
- package/data/problems/the-skyline-problem.json +1 -0
- package/data/problems/third-maximum-number.json +1 -0
- package/data/problems/three-equal-parts.json +1 -0
- package/data/problems/time-based-key-value-store.json +1 -0
- package/data/problems/to-lower-case.json +1 -0
- package/data/problems/toeplitz-matrix.json +1 -0
- package/data/problems/top-k-frequent-elements.json +1 -0
- package/data/problems/top-k-frequent-words.json +1 -0
- package/data/problems/total-hamming-distance.json +1 -0
- package/data/problems/transform-to-chessboard.json +1 -0
- package/data/problems/transpose-matrix.json +1 -0
- package/data/problems/trapping-rain-water-ii.json +1 -0
- package/data/problems/trapping-rain-water.json +1 -0
- package/data/problems/triangle.json +1 -0
- package/data/problems/trim-a-binary-search-tree.json +1 -0
- package/data/problems/triples-with-bitwise-and-equal-to-zero.json +1 -0
- package/data/problems/two-sum-ii-input-array-is-sorted.json +1 -0
- package/data/problems/two-sum-iii-data-structure-design.json +1 -0
- package/data/problems/two-sum-iv-input-is-a-bst.json +1 -0
- package/data/problems/two-sum.json +1 -0
- package/data/problems/ugly-number-ii.json +1 -0
- package/data/problems/ugly-number.json +1 -0
- package/data/problems/uncommon-words-from-two-sentences.json +1 -0
- package/data/problems/unique-binary-search-trees-ii.json +1 -0
- package/data/problems/unique-binary-search-trees.json +1 -0
- package/data/problems/unique-email-addresses.json +1 -0
- package/data/problems/unique-morse-code-words.json +1 -0
- package/data/problems/unique-paths-ii.json +1 -0
- package/data/problems/unique-paths-iii.json +1 -0
- package/data/problems/unique-paths.json +1 -0
- package/data/problems/unique-substrings-in-wraparound-string.json +1 -0
- package/data/problems/unique-word-abbreviation.json +1 -0
- package/data/problems/univalued-binary-tree.json +1 -0
- package/data/problems/utf-8-validation.json +1 -0
- package/data/problems/valid-anagram.json +1 -0
- package/data/problems/valid-mountain-array.json +1 -0
- package/data/problems/valid-number.json +1 -0
- package/data/problems/valid-palindrome-ii.json +1 -0
- package/data/problems/valid-palindrome.json +1 -0
- package/data/problems/valid-parentheses.json +1 -0
- package/data/problems/valid-parenthesis-string.json +1 -0
- package/data/problems/valid-perfect-square.json +1 -0
- package/data/problems/valid-permutations-for-di-sequence.json +1 -0
- package/data/problems/valid-square.json +1 -0
- package/data/problems/valid-sudoku.json +1 -0
- package/data/problems/valid-tic-tac-toe-state.json +1 -0
- package/data/problems/valid-triangle-number.json +1 -0
- package/data/problems/valid-word-abbreviation.json +1 -0
- package/data/problems/valid-word-square.json +1 -0
- package/data/problems/validate-binary-search-tree.json +1 -0
- package/data/problems/validate-ip-address.json +1 -0
- package/data/problems/validate-stack-sequences.json +1 -0
- package/data/problems/verify-preorder-sequence-in-binary-search-tree.json +1 -0
- package/data/problems/verify-preorder-serialization-of-a-binary-tree.json +1 -0
- package/data/problems/verifying-an-alien-dictionary.json +1 -0
- package/data/problems/vertical-order-traversal-of-a-binary-tree.json +1 -0
- package/data/problems/vowel-spellchecker.json +1 -0
- package/data/problems/walking-robot-simulation.json +1 -0
- package/data/problems/walls-and-gates.json +1 -0
- package/data/problems/water-and-jug-problem.json +1 -0
- package/data/problems/wiggle-sort-ii.json +1 -0
- package/data/problems/wiggle-sort.json +1 -0
- package/data/problems/wiggle-subsequence.json +1 -0
- package/data/problems/wildcard-matching.json +1 -0
- package/data/problems/word-abbreviation.json +1 -0
- package/data/problems/word-break-ii.json +1 -0
- package/data/problems/word-break.json +1 -0
- package/data/problems/word-ladder-ii.json +1 -0
- package/data/problems/word-ladder.json +1 -0
- package/data/problems/word-pattern-ii.json +1 -0
- package/data/problems/word-pattern.json +1 -0
- package/data/problems/word-search-ii.json +1 -0
- package/data/problems/word-search.json +1 -0
- package/data/problems/word-squares.json +1 -0
- package/data/problems/word-subsets.json +1 -0
- package/data/problems/x-of-a-kind-in-a-deck-of-cards.json +1 -0
- package/data/problems/zigzag-conversion.json +1 -0
- package/data/problems/zigzag-iterator.json +1 -0
- package/data/problems/zuma-game.json +1 -0
- package/dist/cli.js +793 -0
- package/dist/web/assets/index-DCYvZg7a.js +150 -0
- package/dist/web/assets/index-gSBueMfH.css +1 -0
- package/dist/web/index.html +13 -0
- package/package.json +44 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "601", "slug": "output-contest-matches", "id": 601, "title": "Output Contest Matches", "difficulty": "Medium", "category": "string", "link": "https://leetcode.com/problems/output-contest-matches/", "examples": [{"input": "n = 4", "output": "\"((1,4),(2,3))\"", "explanation": "Two semifinals wrapped in a final."}, {"input": "n = 8", "output": "\"(((1,8),(4,5)),((2,7),(3,6)))\"", "explanation": "Three rounds of nesting."}, {"input": "n = 2", "output": "\"(1,2)\""}], "hints": ["Keep an array of bracket strings starting as \"1\"..\"n\" and repeatedly fold it: new[i] = \"(\" + cur[i] + \",\" + cur[size-1-i] + \")\".", "Halve the active size after each round until one string remains."], "statement": "A knockout tournament starts with `n` ranked squads numbered `1` through `n`, where `1` is strongest and `n` is weakest. The count `n` is always a power of two.\n\nIn every round, the remaining entries are paired strongest-with-weakest: the first remaining entry meets the last, the second meets the second-last, and so on. Each pair is written as `(a,b)`. Winners advance, keeping their bracket text, and the process repeats until one bracket remains.\n\nBuild and return the final bracket string directly from `n` (this task is a plain function of `n`, not a class-design simulation).\n\n**Constraints:**\n- `n` is a power of two, `n == 2^k`\n- `1 <= k <= 12` (so `2 <= n <= 4096`)\n", "solution": "## Approach\n\nSimulate the bracket with a string array initialised to team numbers. Each round replaces the first half with parenthesised pairs of symmetric entries, halving the live size until the champion bracket remains.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n log n) characters processed across rounds.\n- **Space Complexity:** O(n log n) for the nested output strings.\n\n## Implementation\n\n```python\nclass Solution:\n def findContestMatch(self, n: int) -> str:\n cur = [str(i + 1) for i in range(n)]\n size = n\n while size > 1:\n for i in range(size // 2):\n cur[i] = f\"({cur[i]},{cur[size - 1 - i]})\"\n size //= 2\n return cur[0]\n```\n", "starter": {"go": "package main\n\nfunc FindContestMatch(n int) string {\n \n}", "python": "class Solution:\n def findContestMatch(self, n: int) -> str:\n pass", "cpp": "#include <string>\n#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n string findContestMatch(int n) {\n return \"\";\n }\n};"}, "fn": "findContestMatch", "params": [{"name": "n", "type": "int"}], "outputType": "string", "tests": [["4"], ["8"], ["2"], ["16"], ["32"], ["64"], ["128"], ["256"], ["512"], ["1024"], ["2048"], ["4096"], ["4"], ["8"], ["2"], ["16"], ["32"], ["64"], ["128"], ["256"], ["512"], ["1024"], ["2048"], ["4096"], ["4"], ["8"], ["16"], ["32"]], "expected": ["((1,4),(2,3))", "(((1,8),(4,5)),((2,7),(3,6)))", "(1,2)", "((((1,16),(8,9)),((4,13),(5,12))),(((2,15),(7,10)),((3,14),(6,11))))", "(((((1,32),(16,17)),((8,25),(9,24))),(((4,29),(13,20)),((5,28),(12,21)))),((((2,31),(15,18)),((7,26),(10,23))),(((3,30),(14,19)),((6,27),(11,22)))))", "((((((1,64),(32,33)),((16,49),(17,48))),(((8,57),(25,40)),((9,56),(24,41)))),((((4,61),(29,36)),((13,52),(20,45))),(((5,60),(28,37)),((12,53),(21,44))))),(((((2,63),(31,34)),((15,50),(18,47))),(((7,58),(26,39)),((10,55),(23,42)))),((((3,62),(30,35)),((14,51),(19,46))),(((6,59),(27,38)),((11,54),(22,43))))))", "(((((((1,128),(64,65)),((32,97),(33,96))),(((16,113),(49,80)),((17,112),(48,81)))),((((8,121),(57,72)),((25,104),(40,89))),(((9,120),(56,73)),((24,105),(41,88))))),(((((4,125),(61,68)),((29,100),(36,93))),(((13,116),(52,77)),((20,109),(45,84)))),((((5,124),(60,69)),((28,101),(37,92))),(((12,117),(53,76)),((21,108),(44,85)))))),((((((2,127),(63,66)),((31,98),(34,95))),(((15,114),(50,79)),((18,111),(47,82)))),((((7,122),(58,71)),((26,103),(39,90))),(((10,119),(55,74)),((23,106),(42,87))))),(((((3,126),(62,67)),((30,99),(35,94))),(((14,115),(51,78)),((19,110),(46,83)))),((((6,123),(59,70)),((27,102),(38,91))),(((11,118),(54,75)),((22,107),(43,86)))))))", "((((((((1,256),(128,129)),((64,193),(65,192))),(((32,225),(97,160)),((33,224),(96,161)))),((((16,241),(113,144)),((49,208),(80,177))),(((17,240),(112,145)),((48,209),(81,176))))),(((((8,249),(121,136)),((57,200),(72,185))),(((25,232),(104,153)),((40,217),(89,168)))),((((9,248),(120,137)),((56,201),(73,184))),(((24,233),(105,152)),((41,216),(88,169)))))),((((((4,253),(125,132)),((61,196),(68,189))),(((29,228),(100,157)),((36,221),(93,164)))),((((13,244),(116,141)),((52,205),(77,180))),(((20,237),(109,148)),((45,212),(84,173))))),(((((5,252),(124,133)),((60,197),(69,188))),(((28,229),(101,156)),((37,220),(92,165)))),((((12,245),(117,140)),((53,204),(76,181))),(((21,236),(108,149)),((44,213),(85,172))))))),(((((((2,255),(127,130)),((63,194),(66,191))),(((31,226),(98,159)),((34,223),(95,162)))),((((15,242),(114,143)),((50,207),(79,178))),(((18,239),(111,146)),((47,210),(82,175))))),(((((7,250),(122,135)),((58,199),(71,186))),(((26,231),(103,154)),((39,218),(90,167)))),((((10,247),(119,138)),((55,202),(74,183))),(((23,234),(106,151)),((42,215),(87,170)))))),((((((3,254),(126,131)),((62,195),(67,190))),(((30,227),(99,158)),((35,222),(94,163)))),((((14,243),(115,142)),((51,206),(78,179))),(((19,238),(110,147)),((46,211),(83,174))))),(((((6,251),(123,134)),((59,198),(70,187))),(((27,230),(102,155)),((38,219),(91,166)))),((((11,246),(118,139)),((54,203),(75,182))),(((22,235),(107,150)),((43,214),(86,171))))))))", "(((((((((1,512),(256,257)),((128,385),(129,384))),(((64,449),(193,320)),((65,448),(192,321)))),((((32,481),(225,288)),((97,416),(160,353))),(((33,480),(224,289)),((96,417),(161,352))))),(((((16,497),(241,272)),((113,400),(144,369))),(((49,464),(208,305)),((80,433),(177,336)))),((((17,496),(240,273)),((112,401),(145,368))),(((48,465),(209,304)),((81,432),(176,337)))))),((((((8,505),(249,264)),((121,392),(136,377))),(((57,456),(200,313)),((72,441),(185,328)))),((((25,488),(232,281)),((104,409),(153,360))),(((40,473),(217,296)),((89,424),(168,345))))),(((((9,504),(248,265)),((120,393),(137,376))),(((56,457),(201,312)),((73,440),(184,329)))),((((24,489),(233,280)),((105,408),(152,361))),(((41,472),(216,297)),((88,425),(169,344))))))),(((((((4,509),(253,260)),((125,388),(132,381))),(((61,452),(196,317)),((68,445),(189,324)))),((((29,484),(228,285)),((100,413),(157,356))),(((36,477),(221,292)),((93,420),(164,349))))),(((((13,500),(244,269)),((116,397),(141,372))),(((52,461),(205,308)),((77,436),(180,333)))),((((20,493),(237,276)),((109,404),(148,365))),(((45,468),(212,301)),((84,429),(173,340)))))),((((((5,508),(252,261)),((124,389),(133,380))),(((60,453),(197,316)),((69,444),(188,325)))),((((28,485),(229,284)),((101,412),(156,357))),(((37,476),(220,293)),((92,421),(165,348))))),(((((12,501),(245,268)),((117,396),(140,373))),(((53,460),(204,309)),((76,437),(181,332)))),((((21,492),(236,277)),((108,405),(149,364))),(((44,469),(213,300)),((85,428),(172,341)))))))),((((((((2,511),(255,258)),((127,386),(130,383))),(((63,450),(194,319)),((66,447),(191,322)))),((((31,482),(226,287)),((98,415),(159,354))),(((34,479),(223,290)),((95,418),(162,351))))),(((((15,498),(242,271)),((114,399),(143,370))),(((50,463),(207,306)),((79,434),(178,335)))),((((18,495),(239,274)),((111,402),(146,367))),(((47,466),(210,303)),((82,431),(175,338)))))),((((((7,506),(250,263)),((122,391),(135,378))),(((58,455),(199,314)),((71,442),(186,327)))),((((26,487),(231,282)),((103,410),(154,359))),(((39,474),(218,295)),((90,423),(167,346))))),(((((10,503),(247,266)),((119,394),(138,375))),(((55,458),(202,311)),((74,439),(183,330)))),((((23,490),(234,279)),((106,407),(151,362))),(((42,471),(215,298)),((87,426),(170,343))))))),(((((((3,510),(254,259)),((126,387),(131,382))),(((62,451),(195,318)),((67,446),(190,323)))),((((30,483),(227,286)),((99,414),(158,355))),(((35,478),(222,291)),((94,419),(163,350))))),(((((14,499),(243,270)),((115,398),(142,371))),(((51,462),(206,307)),((78,435),(179,334)))),((((19,494),(238,275)),((110,403),(147,366))),(((46,467),(211,302)),((83,430),(174,339)))))),((((((6,507),(251,262)),((123,390),(134,379))),(((59,454),(198,315)),((70,443),(187,326)))),((((27,486),(230,283)),((102,411),(155,358))),(((38,475),(219,294)),((91,422),(166,347))))),(((((11,502),(246,267)),((118,395),(139,374))),(((54,459),(203,310)),((75,438),(182,331)))),((((22,491),(235,278)),((107,406),(150,363))),(((43,470),(214,299)),((86,427),(171,342)))))))))", "((((((((((1,1024),(512,513)),((256,769),(257,768))),(((128,897),(385,640)),((129,896),(384,641)))),((((64,961),(449,576)),((193,832),(320,705))),(((65,960),(448,577)),((192,833),(321,704))))),(((((32,993),(481,544)),((225,800),(288,737))),(((97,928),(416,609)),((160,865),(353,672)))),((((33,992),(480,545)),((224,801),(289,736))),(((96,929),(417,608)),((161,864),(352,673)))))),((((((16,1009),(497,528)),((241,784),(272,753))),(((113,912),(400,625)),((144,881),(369,656)))),((((49,976),(464,561)),((208,817),(305,720))),(((80,945),(433,592)),((177,848),(336,689))))),(((((17,1008),(496,529)),((240,785),(273,752))),(((112,913),(401,624)),((145,880),(368,657)))),((((48,977),(465,560)),((209,816),(304,721))),(((81,944),(432,593)),((176,849),(337,688))))))),(((((((8,1017),(505,520)),((249,776),(264,761))),(((121,904),(392,633)),((136,889),(377,648)))),((((57,968),(456,569)),((200,825),(313,712))),(((72,953),(441,584)),((185,840),(328,697))))),(((((25,1000),(488,537)),((232,793),(281,744))),(((104,921),(409,616)),((153,872),(360,665)))),((((40,985),(473,552)),((217,808),(296,729))),(((89,936),(424,601)),((168,857),(345,680)))))),((((((9,1016),(504,521)),((248,777),(265,760))),(((120,905),(393,632)),((137,888),(376,649)))),((((56,969),(457,568)),((201,824),(312,713))),(((73,952),(440,585)),((184,841),(329,696))))),(((((24,1001),(489,536)),((233,792),(280,745))),(((105,920),(408,617)),((152,873),(361,664)))),((((41,984),(472,553)),((216,809),(297,728))),(((88,937),(425,600)),((169,856),(344,681)))))))),((((((((4,1021),(509,516)),((253,772),(260,765))),(((125,900),(388,637)),((132,893),(381,644)))),((((61,964),(452,573)),((196,829),(317,708))),(((68,957),(445,580)),((189,836),(324,701))))),(((((29,996),(484,541)),((228,797),(285,740))),(((100,925),(413,612)),((157,868),(356,669)))),((((36,989),(477,548)),((221,804),(292,733))),(((93,932),(420,605)),((164,861),(349,676)))))),((((((13,1012),(500,525)),((244,781),(269,756))),(((116,909),(397,628)),((141,884),(372,653)))),((((52,973),(461,564)),((205,820),(308,717))),(((77,948),(436,589)),((180,845),(333,692))))),(((((20,1005),(493,532)),((237,788),(276,749))),(((109,916),(404,621)),((148,877),(365,660)))),((((45,980),(468,557)),((212,813),(301,724))),(((84,941),(429,596)),((173,852),(340,685))))))),(((((((5,1020),(508,517)),((252,773),(261,764))),(((124,901),(389,636)),((133,892),(380,645)))),((((60,965),(453,572)),((197,828),(316,709))),(((69,956),(444,581)),((188,837),(325,700))))),(((((28,997),(485,540)),((229,796),(284,741))),(((101,924),(412,613)),((156,869),(357,668)))),((((37,988),(476,549)),((220,805),(293,732))),(((92,933),(421,604)),((165,860),(348,677)))))),((((((12,1013),(501,524)),((245,780),(268,757))),(((117,908),(396,629)),((140,885),(373,652)))),((((53,972),(460,565)),((204,821),(309,716))),(((76,949),(437,588)),((181,844),(332,693))))),(((((21,1004),(492,533)),((236,789),(277,748))),(((108,917),(405,620)),((149,876),(364,661)))),((((44,981),(469,556)),((213,812),(300,725))),(((85,940),(428,597)),((172,853),(341,684))))))))),(((((((((2,1023),(511,514)),((255,770),(258,767))),(((127,898),(386,639)),((130,895),(383,642)))),((((63,962),(450,575)),((194,831),(319,706))),(((66,959),(447,578)),((191,834),(322,703))))),(((((31,994),(482,543)),((226,799),(287,738))),(((98,927),(415,610)),((159,866),(354,671)))),((((34,991),(479,546)),((223,802),(290,735))),(((95,930),(418,607)),((162,863),(351,674)))))),((((((15,1010),(498,527)),((242,783),(271,754))),(((114,911),(399,626)),((143,882),(370,655)))),((((50,975),(463,562)),((207,818),(306,719))),(((79,946),(434,591)),((178,847),(335,690))))),(((((18,1007),(495,530)),((239,786),(274,751))),(((111,914),(402,623)),((146,879),(367,658)))),((((47,978),(466,559)),((210,815),(303,722))),(((82,943),(431,594)),((175,850),(338,687))))))),(((((((7,1018),(506,519)),((250,775),(263,762))),(((122,903),(391,634)),((135,890),(378,647)))),((((58,967),(455,570)),((199,826),(314,711))),(((71,954),(442,583)),((186,839),(327,698))))),(((((26,999),(487,538)),((231,794),(282,743))),(((103,922),(410,615)),((154,871),(359,666)))),((((39,986),(474,551)),((218,807),(295,730))),(((90,935),(423,602)),((167,858),(346,679)))))),((((((10,1015),(503,522)),((247,778),(266,759))),(((119,906),(394,631)),((138,887),(375,650)))),((((55,970),(458,567)),((202,823),(311,714))),(((74,951),(439,586)),((183,842),(330,695))))),(((((23,1002),(490,535)),((234,791),(279,746))),(((106,919),(407,618)),((151,874),(362,663)))),((((42,983),(471,554)),((215,810),(298,727))),(((87,938),(426,599)),((170,855),(343,682)))))))),((((((((3,1022),(510,515)),((254,771),(259,766))),(((126,899),(387,638)),((131,894),(382,643)))),((((62,963),(451,574)),((195,830),(318,707))),(((67,958),(446,579)),((190,835),(323,702))))),(((((30,995),(483,542)),((227,798),(286,739))),(((99,926),(414,611)),((158,867),(355,670)))),((((35,990),(478,547)),((222,803),(291,734))),(((94,931),(419,606)),((163,862),(350,675)))))),((((((14,1011),(499,526)),((243,782),(270,755))),(((115,910),(398,627)),((142,883),(371,654)))),((((51,974),(462,563)),((206,819),(307,718))),(((78,947),(435,590)),((179,846),(334,691))))),(((((19,1006),(494,531)),((238,787),(275,750))),(((110,915),(403,622)),((147,878),(366,659)))),((((46,979),(467,558)),((211,814),(302,723))),(((83,942),(430,595)),((174,851),(339,686))))))),(((((((6,1019),(507,518)),((251,774),(262,763))),(((123,902),(390,635)),((134,891),(379,646)))),((((59,966),(454,571)),((198,827),(315,710))),(((70,955),(443,582)),((187,838),(326,699))))),(((((27,998),(486,539)),((230,795),(283,742))),(((102,923),(411,614)),((155,870),(358,667)))),((((38,987),(475,550)),((219,806),(294,731))),(((91,934),(422,603)),((166,859),(347,678)))))),((((((11,1014),(502,523)),((246,779),(267,758))),(((118,907),(395,630)),((139,886),(374,651)))),((((54,971),(459,566)),((203,822),(310,715))),(((75,950),(438,587)),((182,843),(331,694))))),(((((22,1003),(491,534)),((235,790),(278,747))),(((107,918),(406,619)),((150,875),(363,662)))),((((43,982),(470,555)),((214,811),(299,726))),(((86,939),(427,598)),((171,854),(342,683))))))))))", "(((((((((((1,2048),(1024,1025)),((512,1537),(513,1536))),(((256,1793),(769,1280)),((257,1792),(768,1281)))),((((128,1921),(897,1152)),((385,1664),(640,1409))),(((129,1920),(896,1153)),((384,1665),(641,1408))))),(((((64,1985),(961,1088)),((449,1600),(576,1473))),(((193,1856),(832,1217)),((320,1729),(705,1344)))),((((65,1984),(960,1089)),((448,1601),(577,1472))),(((192,1857),(833,1216)),((321,1728),(704,1345)))))),((((((32,2017),(993,1056)),((481,1568),(544,1505))),(((225,1824),(800,1249)),((288,1761),(737,1312)))),((((97,1952),(928,1121)),((416,1633),(609,1440))),(((160,1889),(865,1184)),((353,1696),(672,1377))))),(((((33,2016),(992,1057)),((480,1569),(545,1504))),(((224,1825),(801,1248)),((289,1760),(736,1313)))),((((96,1953),(929,1120)),((417,1632),(608,1441))),(((161,1888),(864,1185)),((352,1697),(673,1376))))))),(((((((16,2033),(1009,1040)),((497,1552),(528,1521))),(((241,1808),(784,1265)),((272,1777),(753,1296)))),((((113,1936),(912,1137)),((400,1649),(625,1424))),(((144,1905),(881,1168)),((369,1680),(656,1393))))),(((((49,2000),(976,1073)),((464,1585),(561,1488))),(((208,1841),(817,1232)),((305,1744),(720,1329)))),((((80,1969),(945,1104)),((433,1616),(592,1457))),(((177,1872),(848,1201)),((336,1713),(689,1360)))))),((((((17,2032),(1008,1041)),((496,1553),(529,1520))),(((240,1809),(785,1264)),((273,1776),(752,1297)))),((((112,1937),(913,1136)),((401,1648),(624,1425))),(((145,1904),(880,1169)),((368,1681),(657,1392))))),(((((48,2001),(977,1072)),((465,1584),(560,1489))),(((209,1840),(816,1233)),((304,1745),(721,1328)))),((((81,1968),(944,1105)),((432,1617),(593,1456))),(((176,1873),(849,1200)),((337,1712),(688,1361)))))))),((((((((8,2041),(1017,1032)),((505,1544),(520,1529))),(((249,1800),(776,1273)),((264,1785),(761,1288)))),((((121,1928),(904,1145)),((392,1657),(633,1416))),(((136,1913),(889,1160)),((377,1672),(648,1401))))),(((((57,1992),(968,1081)),((456,1593),(569,1480))),(((200,1849),(825,1224)),((313,1736),(712,1337)))),((((72,1977),(953,1096)),((441,1608),(584,1465))),(((185,1864),(840,1209)),((328,1721),(697,1352)))))),((((((25,2024),(1000,1049)),((488,1561),(537,1512))),(((232,1817),(793,1256)),((281,1768),(744,1305)))),((((104,1945),(921,1128)),((409,1640),(616,1433))),(((153,1896),(872,1177)),((360,1689),(665,1384))))),(((((40,2009),(985,1064)),((473,1576),(552,1497))),(((217,1832),(808,1241)),((296,1753),(729,1320)))),((((89,1960),(936,1113)),((424,1625),(601,1448))),(((168,1881),(857,1192)),((345,1704),(680,1369))))))),(((((((9,2040),(1016,1033)),((504,1545),(521,1528))),(((248,1801),(777,1272)),((265,1784),(760,1289)))),((((120,1929),(905,1144)),((393,1656),(632,1417))),(((137,1912),(888,1161)),((376,1673),(649,1400))))),(((((56,1993),(969,1080)),((457,1592),(568,1481))),(((201,1848),(824,1225)),((312,1737),(713,1336)))),((((73,1976),(952,1097)),((440,1609),(585,1464))),(((184,1865),(841,1208)),((329,1720),(696,1353)))))),((((((24,2025),(1001,1048)),((489,1560),(536,1513))),(((233,1816),(792,1257)),((280,1769),(745,1304)))),((((105,1944),(920,1129)),((408,1641),(617,1432))),(((152,1897),(873,1176)),((361,1688),(664,1385))))),(((((41,2008),(984,1065)),((472,1577),(553,1496))),(((216,1833),(809,1240)),((297,1752),(728,1321)))),((((88,1961),(937,1112)),((425,1624),(600,1449))),(((169,1880),(856,1193)),((344,1705),(681,1368))))))))),(((((((((4,2045),(1021,1028)),((509,1540),(516,1533))),(((253,1796),(772,1277)),((260,1789),(765,1284)))),((((125,1924),(900,1149)),((388,1661),(637,1412))),(((132,1917),(893,1156)),((381,1668),(644,1405))))),(((((61,1988),(964,1085)),((452,1597),(573,1476))),(((196,1853),(829,1220)),((317,1732),(708,1341)))),((((68,1981),(957,1092)),((445,1604),(580,1469))),(((189,1860),(836,1213)),((324,1725),(701,1348)))))),((((((29,2020),(996,1053)),((484,1565),(541,1508))),(((228,1821),(797,1252)),((285,1764),(740,1309)))),((((100,1949),(925,1124)),((413,1636),(612,1437))),(((157,1892),(868,1181)),((356,1693),(669,1380))))),(((((36,2013),(989,1060)),((477,1572),(548,1501))),(((221,1828),(804,1245)),((292,1757),(733,1316)))),((((93,1956),(932,1117)),((420,1629),(605,1444))),(((164,1885),(861,1188)),((349,1700),(676,1373))))))),(((((((13,2036),(1012,1037)),((500,1549),(525,1524))),(((244,1805),(781,1268)),((269,1780),(756,1293)))),((((116,1933),(909,1140)),((397,1652),(628,1421))),(((141,1908),(884,1165)),((372,1677),(653,1396))))),(((((52,1997),(973,1076)),((461,1588),(564,1485))),(((205,1844),(820,1229)),((308,1741),(717,1332)))),((((77,1972),(948,1101)),((436,1613),(589,1460))),(((180,1869),(845,1204)),((333,1716),(692,1357)))))),((((((20,2029),(1005,1044)),((493,1556),(532,1517))),(((237,1812),(788,1261)),((276,1773),(749,1300)))),((((109,1940),(916,1133)),((404,1645),(621,1428))),(((148,1901),(877,1172)),((365,1684),(660,1389))))),(((((45,2004),(980,1069)),((468,1581),(557,1492))),(((212,1837),(813,1236)),((301,1748),(724,1325)))),((((84,1965),(941,1108)),((429,1620),(596,1453))),(((173,1876),(852,1197)),((340,1709),(685,1364)))))))),((((((((5,2044),(1020,1029)),((508,1541),(517,1532))),(((252,1797),(773,1276)),((261,1788),(764,1285)))),((((124,1925),(901,1148)),((389,1660),(636,1413))),(((133,1916),(892,1157)),((380,1669),(645,1404))))),(((((60,1989),(965,1084)),((453,1596),(572,1477))),(((197,1852),(828,1221)),((316,1733),(709,1340)))),((((69,1980),(956,1093)),((444,1605),(581,1468))),(((188,1861),(837,1212)),((325,1724),(700,1349)))))),((((((28,2021),(997,1052)),((485,1564),(540,1509))),(((229,1820),(796,1253)),((284,1765),(741,1308)))),((((101,1948),(924,1125)),((412,1637),(613,1436))),(((156,1893),(869,1180)),((357,1692),(668,1381))))),(((((37,2012),(988,1061)),((476,1573),(549,1500))),(((220,1829),(805,1244)),((293,1756),(732,1317)))),((((92,1957),(933,1116)),((421,1628),(604,1445))),(((165,1884),(860,1189)),((348,1701),(677,1372))))))),(((((((12,2037),(1013,1036)),((501,1548),(524,1525))),(((245,1804),(780,1269)),((268,1781),(757,1292)))),((((117,1932),(908,1141)),((396,1653),(629,1420))),(((140,1909),(885,1164)),((373,1676),(652,1397))))),(((((53,1996),(972,1077)),((460,1589),(565,1484))),(((204,1845),(821,1228)),((309,1740),(716,1333)))),((((76,1973),(949,1100)),((437,1612),(588,1461))),(((181,1868),(844,1205)),((332,1717),(693,1356)))))),((((((21,2028),(1004,1045)),((492,1557),(533,1516))),(((236,1813),(789,1260)),((277,1772),(748,1301)))),((((108,1941),(917,1132)),((405,1644),(620,1429))),(((149,1900),(876,1173)),((364,1685),(661,1388))))),(((((44,2005),(981,1068)),((469,1580),(556,1493))),(((213,1836),(812,1237)),((300,1749),(725,1324)))),((((85,1964),(940,1109)),((428,1621),(597,1452))),(((172,1877),(853,1196)),((341,1708),(684,1365)))))))))),((((((((((2,2047),(1023,1026)),((511,1538),(514,1535))),(((255,1794),(770,1279)),((258,1791),(767,1282)))),((((127,1922),(898,1151)),((386,1663),(639,1410))),(((130,1919),(895,1154)),((383,1666),(642,1407))))),(((((63,1986),(962,1087)),((450,1599),(575,1474))),(((194,1855),(831,1218)),((319,1730),(706,1343)))),((((66,1983),(959,1090)),((447,1602),(578,1471))),(((191,1858),(834,1215)),((322,1727),(703,1346)))))),((((((31,2018),(994,1055)),((482,1567),(543,1506))),(((226,1823),(799,1250)),((287,1762),(738,1311)))),((((98,1951),(927,1122)),((415,1634),(610,1439))),(((159,1890),(866,1183)),((354,1695),(671,1378))))),(((((34,2015),(991,1058)),((479,1570),(546,1503))),(((223,1826),(802,1247)),((290,1759),(735,1314)))),((((95,1954),(930,1119)),((418,1631),(607,1442))),(((162,1887),(863,1186)),((351,1698),(674,1375))))))),(((((((15,2034),(1010,1039)),((498,1551),(527,1522))),(((242,1807),(783,1266)),((271,1778),(754,1295)))),((((114,1935),(911,1138)),((399,1650),(626,1423))),(((143,1906),(882,1167)),((370,1679),(655,1394))))),(((((50,1999),(975,1074)),((463,1586),(562,1487))),(((207,1842),(818,1231)),((306,1743),(719,1330)))),((((79,1970),(946,1103)),((434,1615),(591,1458))),(((178,1871),(847,1202)),((335,1714),(690,1359)))))),((((((18,2031),(1007,1042)),((495,1554),(530,1519))),(((239,1810),(786,1263)),((274,1775),(751,1298)))),((((111,1938),(914,1135)),((402,1647),(623,1426))),(((146,1903),(879,1170)),((367,1682),(658,1391))))),(((((47,2002),(978,1071)),((466,1583),(559,1490))),(((210,1839),(815,1234)),((303,1746),(722,1327)))),((((82,1967),(943,1106)),((431,1618),(594,1455))),(((175,1874),(850,1199)),((338,1711),(687,1362)))))))),((((((((7,2042),(1018,1031)),((506,1543),(519,1530))),(((250,1799),(775,1274)),((263,1786),(762,1287)))),((((122,1927),(903,1146)),((391,1658),(634,1415))),(((135,1914),(890,1159)),((378,1671),(647,1402))))),(((((58,1991),(967,1082)),((455,1594),(570,1479))),(((199,1850),(826,1223)),((314,1735),(711,1338)))),((((71,1978),(954,1095)),((442,1607),(583,1466))),(((186,1863),(839,1210)),((327,1722),(698,1351)))))),((((((26,2023),(999,1050)),((487,1562),(538,1511))),(((231,1818),(794,1255)),((282,1767),(743,1306)))),((((103,1946),(922,1127)),((410,1639),(615,1434))),(((154,1895),(871,1178)),((359,1690),(666,1383))))),(((((39,2010),(986,1063)),((474,1575),(551,1498))),(((218,1831),(807,1242)),((295,1754),(730,1319)))),((((90,1959),(935,1114)),((423,1626),(602,1447))),(((167,1882),(858,1191)),((346,1703),(679,1370))))))),(((((((10,2039),(1015,1034)),((503,1546),(522,1527))),(((247,1802),(778,1271)),((266,1783),(759,1290)))),((((119,1930),(906,1143)),((394,1655),(631,1418))),(((138,1911),(887,1162)),((375,1674),(650,1399))))),(((((55,1994),(970,1079)),((458,1591),(567,1482))),(((202,1847),(823,1226)),((311,1738),(714,1335)))),((((74,1975),(951,1098)),((439,1610),(586,1463))),(((183,1866),(842,1207)),((330,1719),(695,1354)))))),((((((23,2026),(1002,1047)),((490,1559),(535,1514))),(((234,1815),(791,1258)),((279,1770),(746,1303)))),((((106,1943),(919,1130)),((407,1642),(618,1431))),(((151,1898),(874,1175)),((362,1687),(663,1386))))),(((((42,2007),(983,1066)),((471,1578),(554,1495))),(((215,1834),(810,1239)),((298,1751),(727,1322)))),((((87,1962),(938,1111)),((426,1623),(599,1450))),(((170,1879),(855,1194)),((343,1706),(682,1367))))))))),(((((((((3,2046),(1022,1027)),((510,1539),(515,1534))),(((254,1795),(771,1278)),((259,1790),(766,1283)))),((((126,1923),(899,1150)),((387,1662),(638,1411))),(((131,1918),(894,1155)),((382,1667),(643,1406))))),(((((62,1987),(963,1086)),((451,1598),(574,1475))),(((195,1854),(830,1219)),((318,1731),(707,1342)))),((((67,1982),(958,1091)),((446,1603),(579,1470))),(((190,1859),(835,1214)),((323,1726),(702,1347)))))),((((((30,2019),(995,1054)),((483,1566),(542,1507))),(((227,1822),(798,1251)),((286,1763),(739,1310)))),((((99,1950),(926,1123)),((414,1635),(611,1438))),(((158,1891),(867,1182)),((355,1694),(670,1379))))),(((((35,2014),(990,1059)),((478,1571),(547,1502))),(((222,1827),(803,1246)),((291,1758),(734,1315)))),((((94,1955),(931,1118)),((419,1630),(606,1443))),(((163,1886),(862,1187)),((350,1699),(675,1374))))))),(((((((14,2035),(1011,1038)),((499,1550),(526,1523))),(((243,1806),(782,1267)),((270,1779),(755,1294)))),((((115,1934),(910,1139)),((398,1651),(627,1422))),(((142,1907),(883,1166)),((371,1678),(654,1395))))),(((((51,1998),(974,1075)),((462,1587),(563,1486))),(((206,1843),(819,1230)),((307,1742),(718,1331)))),((((78,1971),(947,1102)),((435,1614),(590,1459))),(((179,1870),(846,1203)),((334,1715),(691,1358)))))),((((((19,2030),(1006,1043)),((494,1555),(531,1518))),(((238,1811),(787,1262)),((275,1774),(750,1299)))),((((110,1939),(915,1134)),((403,1646),(622,1427))),(((147,1902),(878,1171)),((366,1683),(659,1390))))),(((((46,2003),(979,1070)),((467,1582),(558,1491))),(((211,1838),(814,1235)),((302,1747),(723,1326)))),((((83,1966),(942,1107)),((430,1619),(595,1454))),(((174,1875),(851,1198)),((339,1710),(686,1363)))))))),((((((((6,2043),(1019,1030)),((507,1542),(518,1531))),(((251,1798),(774,1275)),((262,1787),(763,1286)))),((((123,1926),(902,1147)),((390,1659),(635,1414))),(((134,1915),(891,1158)),((379,1670),(646,1403))))),(((((59,1990),(966,1083)),((454,1595),(571,1478))),(((198,1851),(827,1222)),((315,1734),(710,1339)))),((((70,1979),(955,1094)),((443,1606),(582,1467))),(((187,1862),(838,1211)),((326,1723),(699,1350)))))),((((((27,2022),(998,1051)),((486,1563),(539,1510))),(((230,1819),(795,1254)),((283,1766),(742,1307)))),((((102,1947),(923,1126)),((411,1638),(614,1435))),(((155,1894),(870,1179)),((358,1691),(667,1382))))),(((((38,2011),(987,1062)),((475,1574),(550,1499))),(((219,1830),(806,1243)),((294,1755),(731,1318)))),((((91,1958),(934,1115)),((422,1627),(603,1446))),(((166,1883),(859,1190)),((347,1702),(678,1371))))))),(((((((11,2038),(1014,1035)),((502,1547),(523,1526))),(((246,1803),(779,1270)),((267,1782),(758,1291)))),((((118,1931),(907,1142)),((395,1654),(630,1419))),(((139,1910),(886,1163)),((374,1675),(651,1398))))),(((((54,1995),(971,1078)),((459,1590),(566,1483))),(((203,1846),(822,1227)),((310,1739),(715,1334)))),((((75,1974),(950,1099)),((438,1611),(587,1462))),(((182,1867),(843,1206)),((331,1718),(694,1355)))))),((((((22,2027),(1003,1046)),((491,1558),(534,1515))),(((235,1814),(790,1259)),((278,1771),(747,1302)))),((((107,1942),(918,1131)),((406,1643),(619,1430))),(((150,1899),(875,1174)),((363,1686),(662,1387))))),(((((43,2006),(982,1067)),((470,1579),(555,1494))),(((214,1835),(811,1238)),((299,1750),(726,1323)))),((((86,1963),(939,1110)),((427,1622),(598,1451))),(((171,1878),(854,1195)),((342,1707),(683,1366)))))))))))", "((((((((((((1,4096),(2048,2049)),((1024,3073),(1025,3072))),(((512,3585),(1537,2560)),((513,3584),(1536,2561)))),((((256,3841),(1793,2304)),((769,3328),(1280,2817))),(((257,3840),(1792,2305)),((768,3329),(1281,2816))))),(((((128,3969),(1921,2176)),((897,3200),(1152,2945))),(((385,3712),(1664,2433)),((640,3457),(1409,2688)))),((((129,3968),(1920,2177)),((896,3201),(1153,2944))),(((384,3713),(1665,2432)),((641,3456),(1408,2689)))))),((((((64,4033),(1985,2112)),((961,3136),(1088,3009))),(((449,3648),(1600,2497)),((576,3521),(1473,2624)))),((((193,3904),(1856,2241)),((832,3265),(1217,2880))),(((320,3777),(1729,2368)),((705,3392),(1344,2753))))),(((((65,4032),(1984,2113)),((960,3137),(1089,3008))),(((448,3649),(1601,2496)),((577,3520),(1472,2625)))),((((192,3905),(1857,2240)),((833,3264),(1216,2881))),(((321,3776),(1728,2369)),((704,3393),(1345,2752))))))),(((((((32,4065),(2017,2080)),((993,3104),(1056,3041))),(((481,3616),(1568,2529)),((544,3553),(1505,2592)))),((((225,3872),(1824,2273)),((800,3297),(1249,2848))),(((288,3809),(1761,2336)),((737,3360),(1312,2785))))),(((((97,4000),(1952,2145)),((928,3169),(1121,2976))),(((416,3681),(1633,2464)),((609,3488),(1440,2657)))),((((160,3937),(1889,2208)),((865,3232),(1184,2913))),(((353,3744),(1696,2401)),((672,3425),(1377,2720)))))),((((((33,4064),(2016,2081)),((992,3105),(1057,3040))),(((480,3617),(1569,2528)),((545,3552),(1504,2593)))),((((224,3873),(1825,2272)),((801,3296),(1248,2849))),(((289,3808),(1760,2337)),((736,3361),(1313,2784))))),(((((96,4001),(1953,2144)),((929,3168),(1120,2977))),(((417,3680),(1632,2465)),((608,3489),(1441,2656)))),((((161,3936),(1888,2209)),((864,3233),(1185,2912))),(((352,3745),(1697,2400)),((673,3424),(1376,2721)))))))),((((((((16,4081),(2033,2064)),((1009,3088),(1040,3057))),(((497,3600),(1552,2545)),((528,3569),(1521,2576)))),((((241,3856),(1808,2289)),((784,3313),(1265,2832))),(((272,3825),(1777,2320)),((753,3344),(1296,2801))))),(((((113,3984),(1936,2161)),((912,3185),(1137,2960))),(((400,3697),(1649,2448)),((625,3472),(1424,2673)))),((((144,3953),(1905,2192)),((881,3216),(1168,2929))),(((369,3728),(1680,2417)),((656,3441),(1393,2704)))))),((((((49,4048),(2000,2097)),((976,3121),(1073,3024))),(((464,3633),(1585,2512)),((561,3536),(1488,2609)))),((((208,3889),(1841,2256)),((817,3280),(1232,2865))),(((305,3792),(1744,2353)),((720,3377),(1329,2768))))),(((((80,4017),(1969,2128)),((945,3152),(1104,2993))),(((433,3664),(1616,2481)),((592,3505),(1457,2640)))),((((177,3920),(1872,2225)),((848,3249),(1201,2896))),(((336,3761),(1713,2384)),((689,3408),(1360,2737))))))),(((((((17,4080),(2032,2065)),((1008,3089),(1041,3056))),(((496,3601),(1553,2544)),((529,3568),(1520,2577)))),((((240,3857),(1809,2288)),((785,3312),(1264,2833))),(((273,3824),(1776,2321)),((752,3345),(1297,2800))))),(((((112,3985),(1937,2160)),((913,3184),(1136,2961))),(((401,3696),(1648,2449)),((624,3473),(1425,2672)))),((((145,3952),(1904,2193)),((880,3217),(1169,2928))),(((368,3729),(1681,2416)),((657,3440),(1392,2705)))))),((((((48,4049),(2001,2096)),((977,3120),(1072,3025))),(((465,3632),(1584,2513)),((560,3537),(1489,2608)))),((((209,3888),(1840,2257)),((816,3281),(1233,2864))),(((304,3793),(1745,2352)),((721,3376),(1328,2769))))),(((((81,4016),(1968,2129)),((944,3153),(1105,2992))),(((432,3665),(1617,2480)),((593,3504),(1456,2641)))),((((176,3921),(1873,2224)),((849,3248),(1200,2897))),(((337,3760),(1712,2385)),((688,3409),(1361,2736))))))))),(((((((((8,4089),(2041,2056)),((1017,3080),(1032,3065))),(((505,3592),(1544,2553)),((520,3577),(1529,2568)))),((((249,3848),(1800,2297)),((776,3321),(1273,2824))),(((264,3833),(1785,2312)),((761,3336),(1288,2809))))),(((((121,3976),(1928,2169)),((904,3193),(1145,2952))),(((392,3705),(1657,2440)),((633,3464),(1416,2681)))),((((136,3961),(1913,2184)),((889,3208),(1160,2937))),(((377,3720),(1672,2425)),((648,3449),(1401,2696)))))),((((((57,4040),(1992,2105)),((968,3129),(1081,3016))),(((456,3641),(1593,2504)),((569,3528),(1480,2617)))),((((200,3897),(1849,2248)),((825,3272),(1224,2873))),(((313,3784),(1736,2361)),((712,3385),(1337,2760))))),(((((72,4025),(1977,2120)),((953,3144),(1096,3001))),(((441,3656),(1608,2489)),((584,3513),(1465,2632)))),((((185,3912),(1864,2233)),((840,3257),(1209,2888))),(((328,3769),(1721,2376)),((697,3400),(1352,2745))))))),(((((((25,4072),(2024,2073)),((1000,3097),(1049,3048))),(((488,3609),(1561,2536)),((537,3560),(1512,2585)))),((((232,3865),(1817,2280)),((793,3304),(1256,2841))),(((281,3816),(1768,2329)),((744,3353),(1305,2792))))),(((((104,3993),(1945,2152)),((921,3176),(1128,2969))),(((409,3688),(1640,2457)),((616,3481),(1433,2664)))),((((153,3944),(1896,2201)),((872,3225),(1177,2920))),(((360,3737),(1689,2408)),((665,3432),(1384,2713)))))),((((((40,4057),(2009,2088)),((985,3112),(1064,3033))),(((473,3624),(1576,2521)),((552,3545),(1497,2600)))),((((217,3880),(1832,2265)),((808,3289),(1241,2856))),(((296,3801),(1753,2344)),((729,3368),(1320,2777))))),(((((89,4008),(1960,2137)),((936,3161),(1113,2984))),(((424,3673),(1625,2472)),((601,3496),(1448,2649)))),((((168,3929),(1881,2216)),((857,3240),(1192,2905))),(((345,3752),(1704,2393)),((680,3417),(1369,2728)))))))),((((((((9,4088),(2040,2057)),((1016,3081),(1033,3064))),(((504,3593),(1545,2552)),((521,3576),(1528,2569)))),((((248,3849),(1801,2296)),((777,3320),(1272,2825))),(((265,3832),(1784,2313)),((760,3337),(1289,2808))))),(((((120,3977),(1929,2168)),((905,3192),(1144,2953))),(((393,3704),(1656,2441)),((632,3465),(1417,2680)))),((((137,3960),(1912,2185)),((888,3209),(1161,2936))),(((376,3721),(1673,2424)),((649,3448),(1400,2697)))))),((((((56,4041),(1993,2104)),((969,3128),(1080,3017))),(((457,3640),(1592,2505)),((568,3529),(1481,2616)))),((((201,3896),(1848,2249)),((824,3273),(1225,2872))),(((312,3785),(1737,2360)),((713,3384),(1336,2761))))),(((((73,4024),(1976,2121)),((952,3145),(1097,3000))),(((440,3657),(1609,2488)),((585,3512),(1464,2633)))),((((184,3913),(1865,2232)),((841,3256),(1208,2889))),(((329,3768),(1720,2377)),((696,3401),(1353,2744))))))),(((((((24,4073),(2025,2072)),((1001,3096),(1048,3049))),(((489,3608),(1560,2537)),((536,3561),(1513,2584)))),((((233,3864),(1816,2281)),((792,3305),(1257,2840))),(((280,3817),(1769,2328)),((745,3352),(1304,2793))))),(((((105,3992),(1944,2153)),((920,3177),(1129,2968))),(((408,3689),(1641,2456)),((617,3480),(1432,2665)))),((((152,3945),(1897,2200)),((873,3224),(1176,2921))),(((361,3736),(1688,2409)),((664,3433),(1385,2712)))))),((((((41,4056),(2008,2089)),((984,3113),(1065,3032))),(((472,3625),(1577,2520)),((553,3544),(1496,2601)))),((((216,3881),(1833,2264)),((809,3288),(1240,2857))),(((297,3800),(1752,2345)),((728,3369),(1321,2776))))),(((((88,4009),(1961,2136)),((937,3160),(1112,2985))),(((425,3672),(1624,2473)),((600,3497),(1449,2648)))),((((169,3928),(1880,2217)),((856,3241),(1193,2904))),(((344,3753),(1705,2392)),((681,3416),(1368,2729)))))))))),((((((((((4,4093),(2045,2052)),((1021,3076),(1028,3069))),(((509,3588),(1540,2557)),((516,3581),(1533,2564)))),((((253,3844),(1796,2301)),((772,3325),(1277,2820))),(((260,3837),(1789,2308)),((765,3332),(1284,2813))))),(((((125,3972),(1924,2173)),((900,3197),(1149,2948))),(((388,3709),(1661,2436)),((637,3460),(1412,2685)))),((((132,3965),(1917,2180)),((893,3204),(1156,2941))),(((381,3716),(1668,2429)),((644,3453),(1405,2692)))))),((((((61,4036),(1988,2109)),((964,3133),(1085,3012))),(((452,3645),(1597,2500)),((573,3524),(1476,2621)))),((((196,3901),(1853,2244)),((829,3268),(1220,2877))),(((317,3780),(1732,2365)),((708,3389),(1341,2756))))),(((((68,4029),(1981,2116)),((957,3140),(1092,3005))),(((445,3652),(1604,2493)),((580,3517),(1469,2628)))),((((189,3908),(1860,2237)),((836,3261),(1213,2884))),(((324,3773),(1725,2372)),((701,3396),(1348,2749))))))),(((((((29,4068),(2020,2077)),((996,3101),(1053,3044))),(((484,3613),(1565,2532)),((541,3556),(1508,2589)))),((((228,3869),(1821,2276)),((797,3300),(1252,2845))),(((285,3812),(1764,2333)),((740,3357),(1309,2788))))),(((((100,3997),(1949,2148)),((925,3172),(1124,2973))),(((413,3684),(1636,2461)),((612,3485),(1437,2660)))),((((157,3940),(1892,2205)),((868,3229),(1181,2916))),(((356,3741),(1693,2404)),((669,3428),(1380,2717)))))),((((((36,4061),(2013,2084)),((989,3108),(1060,3037))),(((477,3620),(1572,2525)),((548,3549),(1501,2596)))),((((221,3876),(1828,2269)),((804,3293),(1245,2852))),(((292,3805),(1757,2340)),((733,3364),(1316,2781))))),(((((93,4004),(1956,2141)),((932,3165),(1117,2980))),(((420,3677),(1629,2468)),((605,3492),(1444,2653)))),((((164,3933),(1885,2212)),((861,3236),(1188,2909))),(((349,3748),(1700,2397)),((676,3421),(1373,2724)))))))),((((((((13,4084),(2036,2061)),((1012,3085),(1037,3060))),(((500,3597),(1549,2548)),((525,3572),(1524,2573)))),((((244,3853),(1805,2292)),((781,3316),(1268,2829))),(((269,3828),(1780,2317)),((756,3341),(1293,2804))))),(((((116,3981),(1933,2164)),((909,3188),(1140,2957))),(((397,3700),(1652,2445)),((628,3469),(1421,2676)))),((((141,3956),(1908,2189)),((884,3213),(1165,2932))),(((372,3725),(1677,2420)),((653,3444),(1396,2701)))))),((((((52,4045),(1997,2100)),((973,3124),(1076,3021))),(((461,3636),(1588,2509)),((564,3533),(1485,2612)))),((((205,3892),(1844,2253)),((820,3277),(1229,2868))),(((308,3789),(1741,2356)),((717,3380),(1332,2765))))),(((((77,4020),(1972,2125)),((948,3149),(1101,2996))),(((436,3661),(1613,2484)),((589,3508),(1460,2637)))),((((180,3917),(1869,2228)),((845,3252),(1204,2893))),(((333,3764),(1716,2381)),((692,3405),(1357,2740))))))),(((((((20,4077),(2029,2068)),((1005,3092),(1044,3053))),(((493,3604),(1556,2541)),((532,3565),(1517,2580)))),((((237,3860),(1812,2285)),((788,3309),(1261,2836))),(((276,3821),(1773,2324)),((749,3348),(1300,2797))))),(((((109,3988),(1940,2157)),((916,3181),(1133,2964))),(((404,3693),(1645,2452)),((621,3476),(1428,2669)))),((((148,3949),(1901,2196)),((877,3220),(1172,2925))),(((365,3732),(1684,2413)),((660,3437),(1389,2708)))))),((((((45,4052),(2004,2093)),((980,3117),(1069,3028))),(((468,3629),(1581,2516)),((557,3540),(1492,2605)))),((((212,3885),(1837,2260)),((813,3284),(1236,2861))),(((301,3796),(1748,2349)),((724,3373),(1325,2772))))),(((((84,4013),(1965,2132)),((941,3156),(1108,2989))),(((429,3668),(1620,2477)),((596,3501),(1453,2644)))),((((173,3924),(1876,2221)),((852,3245),(1197,2900))),(((340,3757),(1709,2388)),((685,3412),(1364,2733))))))))),(((((((((5,4092),(2044,2053)),((1020,3077),(1029,3068))),(((508,3589),(1541,2556)),((517,3580),(1532,2565)))),((((252,3845),(1797,2300)),((773,3324),(1276,2821))),(((261,3836),(1788,2309)),((764,3333),(1285,2812))))),(((((124,3973),(1925,2172)),((901,3196),(1148,2949))),(((389,3708),(1660,2437)),((636,3461),(1413,2684)))),((((133,3964),(1916,2181)),((892,3205),(1157,2940))),(((380,3717),(1669,2428)),((645,3452),(1404,2693)))))),((((((60,4037),(1989,2108)),((965,3132),(1084,3013))),(((453,3644),(1596,2501)),((572,3525),(1477,2620)))),((((197,3900),(1852,2245)),((828,3269),(1221,2876))),(((316,3781),(1733,2364)),((709,3388),(1340,2757))))),(((((69,4028),(1980,2117)),((956,3141),(1093,3004))),(((444,3653),(1605,2492)),((581,3516),(1468,2629)))),((((188,3909),(1861,2236)),((837,3260),(1212,2885))),(((325,3772),(1724,2373)),((700,3397),(1349,2748))))))),(((((((28,4069),(2021,2076)),((997,3100),(1052,3045))),(((485,3612),(1564,2533)),((540,3557),(1509,2588)))),((((229,3868),(1820,2277)),((796,3301),(1253,2844))),(((284,3813),(1765,2332)),((741,3356),(1308,2789))))),(((((101,3996),(1948,2149)),((924,3173),(1125,2972))),(((412,3685),(1637,2460)),((613,3484),(1436,2661)))),((((156,3941),(1893,2204)),((869,3228),(1180,2917))),(((357,3740),(1692,2405)),((668,3429),(1381,2716)))))),((((((37,4060),(2012,2085)),((988,3109),(1061,3036))),(((476,3621),(1573,2524)),((549,3548),(1500,2597)))),((((220,3877),(1829,2268)),((805,3292),(1244,2853))),(((293,3804),(1756,2341)),((732,3365),(1317,2780))))),(((((92,4005),(1957,2140)),((933,3164),(1116,2981))),(((421,3676),(1628,2469)),((604,3493),(1445,2652)))),((((165,3932),(1884,2213)),((860,3237),(1189,2908))),(((348,3749),(1701,2396)),((677,3420),(1372,2725)))))))),((((((((12,4085),(2037,2060)),((1013,3084),(1036,3061))),(((501,3596),(1548,2549)),((524,3573),(1525,2572)))),((((245,3852),(1804,2293)),((780,3317),(1269,2828))),(((268,3829),(1781,2316)),((757,3340),(1292,2805))))),(((((117,3980),(1932,2165)),((908,3189),(1141,2956))),(((396,3701),(1653,2444)),((629,3468),(1420,2677)))),((((140,3957),(1909,2188)),((885,3212),(1164,2933))),(((373,3724),(1676,2421)),((652,3445),(1397,2700)))))),((((((53,4044),(1996,2101)),((972,3125),(1077,3020))),(((460,3637),(1589,2508)),((565,3532),(1484,2613)))),((((204,3893),(1845,2252)),((821,3276),(1228,2869))),(((309,3788),(1740,2357)),((716,3381),(1333,2764))))),(((((76,4021),(1973,2124)),((949,3148),(1100,2997))),(((437,3660),(1612,2485)),((588,3509),(1461,2636)))),((((181,3916),(1868,2229)),((844,3253),(1205,2892))),(((332,3765),(1717,2380)),((693,3404),(1356,2741))))))),(((((((21,4076),(2028,2069)),((1004,3093),(1045,3052))),(((492,3605),(1557,2540)),((533,3564),(1516,2581)))),((((236,3861),(1813,2284)),((789,3308),(1260,2837))),(((277,3820),(1772,2325)),((748,3349),(1301,2796))))),(((((108,3989),(1941,2156)),((917,3180),(1132,2965))),(((405,3692),(1644,2453)),((620,3477),(1429,2668)))),((((149,3948),(1900,2197)),((876,3221),(1173,2924))),(((364,3733),(1685,2412)),((661,3436),(1388,2709)))))),((((((44,4053),(2005,2092)),((981,3116),(1068,3029))),(((469,3628),(1580,2517)),((556,3541),(1493,2604)))),((((213,3884),(1836,2261)),((812,3285),(1237,2860))),(((300,3797),(1749,2348)),((725,3372),(1324,2773))))),(((((85,4012),(1964,2133)),((940,3157),(1109,2988))),(((428,3669),(1621,2476)),((597,3500),(1452,2645)))),((((172,3925),(1877,2220)),((853,3244),(1196,2901))),(((341,3756),(1708,2389)),((684,3413),(1365,2732))))))))))),(((((((((((2,4095),(2047,2050)),((1023,3074),(1026,3071))),(((511,3586),(1538,2559)),((514,3583),(1535,2562)))),((((255,3842),(1794,2303)),((770,3327),(1279,2818))),(((258,3839),(1791,2306)),((767,3330),(1282,2815))))),(((((127,3970),(1922,2175)),((898,3199),(1151,2946))),(((386,3711),(1663,2434)),((639,3458),(1410,2687)))),((((130,3967),(1919,2178)),((895,3202),(1154,2943))),(((383,3714),(1666,2431)),((642,3455),(1407,2690)))))),((((((63,4034),(1986,2111)),((962,3135),(1087,3010))),(((450,3647),(1599,2498)),((575,3522),(1474,2623)))),((((194,3903),(1855,2242)),((831,3266),(1218,2879))),(((319,3778),(1730,2367)),((706,3391),(1343,2754))))),(((((66,4031),(1983,2114)),((959,3138),(1090,3007))),(((447,3650),(1602,2495)),((578,3519),(1471,2626)))),((((191,3906),(1858,2239)),((834,3263),(1215,2882))),(((322,3775),(1727,2370)),((703,3394),(1346,2751))))))),(((((((31,4066),(2018,2079)),((994,3103),(1055,3042))),(((482,3615),(1567,2530)),((543,3554),(1506,2591)))),((((226,3871),(1823,2274)),((799,3298),(1250,2847))),(((287,3810),(1762,2335)),((738,3359),(1311,2786))))),(((((98,3999),(1951,2146)),((927,3170),(1122,2975))),(((415,3682),(1634,2463)),((610,3487),(1439,2658)))),((((159,3938),(1890,2207)),((866,3231),(1183,2914))),(((354,3743),(1695,2402)),((671,3426),(1378,2719)))))),((((((34,4063),(2015,2082)),((991,3106),(1058,3039))),(((479,3618),(1570,2527)),((546,3551),(1503,2594)))),((((223,3874),(1826,2271)),((802,3295),(1247,2850))),(((290,3807),(1759,2338)),((735,3362),(1314,2783))))),(((((95,4002),(1954,2143)),((930,3167),(1119,2978))),(((418,3679),(1631,2466)),((607,3490),(1442,2655)))),((((162,3935),(1887,2210)),((863,3234),(1186,2911))),(((351,3746),(1698,2399)),((674,3423),(1375,2722)))))))),((((((((15,4082),(2034,2063)),((1010,3087),(1039,3058))),(((498,3599),(1551,2546)),((527,3570),(1522,2575)))),((((242,3855),(1807,2290)),((783,3314),(1266,2831))),(((271,3826),(1778,2319)),((754,3343),(1295,2802))))),(((((114,3983),(1935,2162)),((911,3186),(1138,2959))),(((399,3698),(1650,2447)),((626,3471),(1423,2674)))),((((143,3954),(1906,2191)),((882,3215),(1167,2930))),(((370,3727),(1679,2418)),((655,3442),(1394,2703)))))),((((((50,4047),(1999,2098)),((975,3122),(1074,3023))),(((463,3634),(1586,2511)),((562,3535),(1487,2610)))),((((207,3890),(1842,2255)),((818,3279),(1231,2866))),(((306,3791),(1743,2354)),((719,3378),(1330,2767))))),(((((79,4018),(1970,2127)),((946,3151),(1103,2994))),(((434,3663),(1615,2482)),((591,3506),(1458,2639)))),((((178,3919),(1871,2226)),((847,3250),(1202,2895))),(((335,3762),(1714,2383)),((690,3407),(1359,2738))))))),(((((((18,4079),(2031,2066)),((1007,3090),(1042,3055))),(((495,3602),(1554,2543)),((530,3567),(1519,2578)))),((((239,3858),(1810,2287)),((786,3311),(1263,2834))),(((274,3823),(1775,2322)),((751,3346),(1298,2799))))),(((((111,3986),(1938,2159)),((914,3183),(1135,2962))),(((402,3695),(1647,2450)),((623,3474),(1426,2671)))),((((146,3951),(1903,2194)),((879,3218),(1170,2927))),(((367,3730),(1682,2415)),((658,3439),(1391,2706)))))),((((((47,4050),(2002,2095)),((978,3119),(1071,3026))),(((466,3631),(1583,2514)),((559,3538),(1490,2607)))),((((210,3887),(1839,2258)),((815,3282),(1234,2863))),(((303,3794),(1746,2351)),((722,3375),(1327,2770))))),(((((82,4015),(1967,2130)),((943,3154),(1106,2991))),(((431,3666),(1618,2479)),((594,3503),(1455,2642)))),((((175,3922),(1874,2223)),((850,3247),(1199,2898))),(((338,3759),(1711,2386)),((687,3410),(1362,2735))))))))),(((((((((7,4090),(2042,2055)),((1018,3079),(1031,3066))),(((506,3591),(1543,2554)),((519,3578),(1530,2567)))),((((250,3847),(1799,2298)),((775,3322),(1274,2823))),(((263,3834),(1786,2311)),((762,3335),(1287,2810))))),(((((122,3975),(1927,2170)),((903,3194),(1146,2951))),(((391,3706),(1658,2439)),((634,3463),(1415,2682)))),((((135,3962),(1914,2183)),((890,3207),(1159,2938))),(((378,3719),(1671,2426)),((647,3450),(1402,2695)))))),((((((58,4039),(1991,2106)),((967,3130),(1082,3015))),(((455,3642),(1594,2503)),((570,3527),(1479,2618)))),((((199,3898),(1850,2247)),((826,3271),(1223,2874))),(((314,3783),(1735,2362)),((711,3386),(1338,2759))))),(((((71,4026),(1978,2119)),((954,3143),(1095,3002))),(((442,3655),(1607,2490)),((583,3514),(1466,2631)))),((((186,3911),(1863,2234)),((839,3258),(1210,2887))),(((327,3770),(1722,2375)),((698,3399),(1351,2746))))))),(((((((26,4071),(2023,2074)),((999,3098),(1050,3047))),(((487,3610),(1562,2535)),((538,3559),(1511,2586)))),((((231,3866),(1818,2279)),((794,3303),(1255,2842))),(((282,3815),(1767,2330)),((743,3354),(1306,2791))))),(((((103,3994),(1946,2151)),((922,3175),(1127,2970))),(((410,3687),(1639,2458)),((615,3482),(1434,2663)))),((((154,3943),(1895,2202)),((871,3226),(1178,2919))),(((359,3738),(1690,2407)),((666,3431),(1383,2714)))))),((((((39,4058),(2010,2087)),((986,3111),(1063,3034))),(((474,3623),(1575,2522)),((551,3546),(1498,2599)))),((((218,3879),(1831,2266)),((807,3290),(1242,2855))),(((295,3802),(1754,2343)),((730,3367),(1319,2778))))),(((((90,4007),(1959,2138)),((935,3162),(1114,2983))),(((423,3674),(1626,2471)),((602,3495),(1447,2650)))),((((167,3930),(1882,2215)),((858,3239),(1191,2906))),(((346,3751),(1703,2394)),((679,3418),(1370,2727)))))))),((((((((10,4087),(2039,2058)),((1015,3082),(1034,3063))),(((503,3594),(1546,2551)),((522,3575),(1527,2570)))),((((247,3850),(1802,2295)),((778,3319),(1271,2826))),(((266,3831),(1783,2314)),((759,3338),(1290,2807))))),(((((119,3978),(1930,2167)),((906,3191),(1143,2954))),(((394,3703),(1655,2442)),((631,3466),(1418,2679)))),((((138,3959),(1911,2186)),((887,3210),(1162,2935))),(((375,3722),(1674,2423)),((650,3447),(1399,2698)))))),((((((55,4042),(1994,2103)),((970,3127),(1079,3018))),(((458,3639),(1591,2506)),((567,3530),(1482,2615)))),((((202,3895),(1847,2250)),((823,3274),(1226,2871))),(((311,3786),(1738,2359)),((714,3383),(1335,2762))))),(((((74,4023),(1975,2122)),((951,3146),(1098,2999))),(((439,3658),(1610,2487)),((586,3511),(1463,2634)))),((((183,3914),(1866,2231)),((842,3255),(1207,2890))),(((330,3767),(1719,2378)),((695,3402),(1354,2743))))))),(((((((23,4074),(2026,2071)),((1002,3095),(1047,3050))),(((490,3607),(1559,2538)),((535,3562),(1514,2583)))),((((234,3863),(1815,2282)),((791,3306),(1258,2839))),(((279,3818),(1770,2327)),((746,3351),(1303,2794))))),(((((106,3991),(1943,2154)),((919,3178),(1130,2967))),(((407,3690),(1642,2455)),((618,3479),(1431,2666)))),((((151,3946),(1898,2199)),((874,3223),(1175,2922))),(((362,3735),(1687,2410)),((663,3434),(1386,2711)))))),((((((42,4055),(2007,2090)),((983,3114),(1066,3031))),(((471,3626),(1578,2519)),((554,3543),(1495,2602)))),((((215,3882),(1834,2263)),((810,3287),(1239,2858))),(((298,3799),(1751,2346)),((727,3370),(1322,2775))))),(((((87,4010),(1962,2135)),((938,3159),(1111,2986))),(((426,3671),(1623,2474)),((599,3498),(1450,2647)))),((((170,3927),(1879,2218)),((855,3242),(1194,2903))),(((343,3754),(1706,2391)),((682,3415),(1367,2730)))))))))),((((((((((3,4094),(2046,2051)),((1022,3075),(1027,3070))),(((510,3587),(1539,2558)),((515,3582),(1534,2563)))),((((254,3843),(1795,2302)),((771,3326),(1278,2819))),(((259,3838),(1790,2307)),((766,3331),(1283,2814))))),(((((126,3971),(1923,2174)),((899,3198),(1150,2947))),(((387,3710),(1662,2435)),((638,3459),(1411,2686)))),((((131,3966),(1918,2179)),((894,3203),(1155,2942))),(((382,3715),(1667,2430)),((643,3454),(1406,2691)))))),((((((62,4035),(1987,2110)),((963,3134),(1086,3011))),(((451,3646),(1598,2499)),((574,3523),(1475,2622)))),((((195,3902),(1854,2243)),((830,3267),(1219,2878))),(((318,3779),(1731,2366)),((707,3390),(1342,2755))))),(((((67,4030),(1982,2115)),((958,3139),(1091,3006))),(((446,3651),(1603,2494)),((579,3518),(1470,2627)))),((((190,3907),(1859,2238)),((835,3262),(1214,2883))),(((323,3774),(1726,2371)),((702,3395),(1347,2750))))))),(((((((30,4067),(2019,2078)),((995,3102),(1054,3043))),(((483,3614),(1566,2531)),((542,3555),(1507,2590)))),((((227,3870),(1822,2275)),((798,3299),(1251,2846))),(((286,3811),(1763,2334)),((739,3358),(1310,2787))))),(((((99,3998),(1950,2147)),((926,3171),(1123,2974))),(((414,3683),(1635,2462)),((611,3486),(1438,2659)))),((((158,3939),(1891,2206)),((867,3230),(1182,2915))),(((355,3742),(1694,2403)),((670,3427),(1379,2718)))))),((((((35,4062),(2014,2083)),((990,3107),(1059,3038))),(((478,3619),(1571,2526)),((547,3550),(1502,2595)))),((((222,3875),(1827,2270)),((803,3294),(1246,2851))),(((291,3806),(1758,2339)),((734,3363),(1315,2782))))),(((((94,4003),(1955,2142)),((931,3166),(1118,2979))),(((419,3678),(1630,2467)),((606,3491),(1443,2654)))),((((163,3934),(1886,2211)),((862,3235),(1187,2910))),(((350,3747),(1699,2398)),((675,3422),(1374,2723)))))))),((((((((14,4083),(2035,2062)),((1011,3086),(1038,3059))),(((499,3598),(1550,2547)),((526,3571),(1523,2574)))),((((243,3854),(1806,2291)),((782,3315),(1267,2830))),(((270,3827),(1779,2318)),((755,3342),(1294,2803))))),(((((115,3982),(1934,2163)),((910,3187),(1139,2958))),(((398,3699),(1651,2446)),((627,3470),(1422,2675)))),((((142,3955),(1907,2190)),((883,3214),(1166,2931))),(((371,3726),(1678,2419)),((654,3443),(1395,2702)))))),((((((51,4046),(1998,2099)),((974,3123),(1075,3022))),(((462,3635),(1587,2510)),((563,3534),(1486,2611)))),((((206,3891),(1843,2254)),((819,3278),(1230,2867))),(((307,3790),(1742,2355)),((718,3379),(1331,2766))))),(((((78,4019),(1971,2126)),((947,3150),(1102,2995))),(((435,3662),(1614,2483)),((590,3507),(1459,2638)))),((((179,3918),(1870,2227)),((846,3251),(1203,2894))),(((334,3763),(1715,2382)),((691,3406),(1358,2739))))))),(((((((19,4078),(2030,2067)),((1006,3091),(1043,3054))),(((494,3603),(1555,2542)),((531,3566),(1518,2579)))),((((238,3859),(1811,2286)),((787,3310),(1262,2835))),(((275,3822),(1774,2323)),((750,3347),(1299,2798))))),(((((110,3987),(1939,2158)),((915,3182),(1134,2963))),(((403,3694),(1646,2451)),((622,3475),(1427,2670)))),((((147,3950),(1902,2195)),((878,3219),(1171,2926))),(((366,3731),(1683,2414)),((659,3438),(1390,2707)))))),((((((46,4051),(2003,2094)),((979,3118),(1070,3027))),(((467,3630),(1582,2515)),((558,3539),(1491,2606)))),((((211,3886),(1838,2259)),((814,3283),(1235,2862))),(((302,3795),(1747,2350)),((723,3374),(1326,2771))))),(((((83,4014),(1966,2131)),((942,3155),(1107,2990))),(((430,3667),(1619,2478)),((595,3502),(1454,2643)))),((((174,3923),(1875,2222)),((851,3246),(1198,2899))),(((339,3758),(1710,2387)),((686,3411),(1363,2734))))))))),(((((((((6,4091),(2043,2054)),((1019,3078),(1030,3067))),(((507,3590),(1542,2555)),((518,3579),(1531,2566)))),((((251,3846),(1798,2299)),((774,3323),(1275,2822))),(((262,3835),(1787,2310)),((763,3334),(1286,2811))))),(((((123,3974),(1926,2171)),((902,3195),(1147,2950))),(((390,3707),(1659,2438)),((635,3462),(1414,2683)))),((((134,3963),(1915,2182)),((891,3206),(1158,2939))),(((379,3718),(1670,2427)),((646,3451),(1403,2694)))))),((((((59,4038),(1990,2107)),((966,3131),(1083,3014))),(((454,3643),(1595,2502)),((571,3526),(1478,2619)))),((((198,3899),(1851,2246)),((827,3270),(1222,2875))),(((315,3782),(1734,2363)),((710,3387),(1339,2758))))),(((((70,4027),(1979,2118)),((955,3142),(1094,3003))),(((443,3654),(1606,2491)),((582,3515),(1467,2630)))),((((187,3910),(1862,2235)),((838,3259),(1211,2886))),(((326,3771),(1723,2374)),((699,3398),(1350,2747))))))),(((((((27,4070),(2022,2075)),((998,3099),(1051,3046))),(((486,3611),(1563,2534)),((539,3558),(1510,2587)))),((((230,3867),(1819,2278)),((795,3302),(1254,2843))),(((283,3814),(1766,2331)),((742,3355),(1307,2790))))),(((((102,3995),(1947,2150)),((923,3174),(1126,2971))),(((411,3686),(1638,2459)),((614,3483),(1435,2662)))),((((155,3942),(1894,2203)),((870,3227),(1179,2918))),(((358,3739),(1691,2406)),((667,3430),(1382,2715)))))),((((((38,4059),(2011,2086)),((987,3110),(1062,3035))),(((475,3622),(1574,2523)),((550,3547),(1499,2598)))),((((219,3878),(1830,2267)),((806,3291),(1243,2854))),(((294,3803),(1755,2342)),((731,3366),(1318,2779))))),(((((91,4006),(1958,2139)),((934,3163),(1115,2982))),(((422,3675),(1627,2470)),((603,3494),(1446,2651)))),((((166,3931),(1883,2214)),((859,3238),(1190,2907))),(((347,3750),(1702,2395)),((678,3419),(1371,2726)))))))),((((((((11,4086),(2038,2059)),((1014,3083),(1035,3062))),(((502,3595),(1547,2550)),((523,3574),(1526,2571)))),((((246,3851),(1803,2294)),((779,3318),(1270,2827))),(((267,3830),(1782,2315)),((758,3339),(1291,2806))))),(((((118,3979),(1931,2166)),((907,3190),(1142,2955))),(((395,3702),(1654,2443)),((630,3467),(1419,2678)))),((((139,3958),(1910,2187)),((886,3211),(1163,2934))),(((374,3723),(1675,2422)),((651,3446),(1398,2699)))))),((((((54,4043),(1995,2102)),((971,3126),(1078,3019))),(((459,3638),(1590,2507)),((566,3531),(1483,2614)))),((((203,3894),(1846,2251)),((822,3275),(1227,2870))),(((310,3787),(1739,2358)),((715,3382),(1334,2763))))),(((((75,4022),(1974,2123)),((950,3147),(1099,2998))),(((438,3659),(1611,2486)),((587,3510),(1462,2635)))),((((182,3915),(1867,2230)),((843,3254),(1206,2891))),(((331,3766),(1718,2379)),((694,3403),(1355,2742))))))),(((((((22,4075),(2027,2070)),((1003,3094),(1046,3051))),(((491,3606),(1558,2539)),((534,3563),(1515,2582)))),((((235,3862),(1814,2283)),((790,3307),(1259,2838))),(((278,3819),(1771,2326)),((747,3350),(1302,2795))))),(((((107,3990),(1942,2155)),((918,3179),(1131,2966))),(((406,3691),(1643,2454)),((619,3478),(1430,2667)))),((((150,3947),(1899,2198)),((875,3222),(1174,2923))),(((363,3734),(1686,2411)),((662,3435),(1387,2710)))))),((((((43,4054),(2006,2091)),((982,3115),(1067,3030))),(((470,3627),(1579,2518)),((555,3542),(1494,2603)))),((((214,3883),(1835,2262)),((811,3286),(1238,2859))),(((299,3798),(1750,2347)),((726,3371),(1323,2774))))),(((((86,4011),(1963,2134)),((939,3158),(1110,2987))),(((427,3670),(1622,2475)),((598,3499),(1451,2646)))),((((171,3926),(1878,2219)),((854,3243),(1195,2902))),(((342,3755),(1707,2390)),((683,3414),(1366,2731))))))))))))", "((1,4),(2,3))", "(((1,8),(4,5)),((2,7),(3,6)))", "(1,2)", "((((1,16),(8,9)),((4,13),(5,12))),(((2,15),(7,10)),((3,14),(6,11))))", "(((((1,32),(16,17)),((8,25),(9,24))),(((4,29),(13,20)),((5,28),(12,21)))),((((2,31),(15,18)),((7,26),(10,23))),(((3,30),(14,19)),((6,27),(11,22)))))", "((((((1,64),(32,33)),((16,49),(17,48))),(((8,57),(25,40)),((9,56),(24,41)))),((((4,61),(29,36)),((13,52),(20,45))),(((5,60),(28,37)),((12,53),(21,44))))),(((((2,63),(31,34)),((15,50),(18,47))),(((7,58),(26,39)),((10,55),(23,42)))),((((3,62),(30,35)),((14,51),(19,46))),(((6,59),(27,38)),((11,54),(22,43))))))", "(((((((1,128),(64,65)),((32,97),(33,96))),(((16,113),(49,80)),((17,112),(48,81)))),((((8,121),(57,72)),((25,104),(40,89))),(((9,120),(56,73)),((24,105),(41,88))))),(((((4,125),(61,68)),((29,100),(36,93))),(((13,116),(52,77)),((20,109),(45,84)))),((((5,124),(60,69)),((28,101),(37,92))),(((12,117),(53,76)),((21,108),(44,85)))))),((((((2,127),(63,66)),((31,98),(34,95))),(((15,114),(50,79)),((18,111),(47,82)))),((((7,122),(58,71)),((26,103),(39,90))),(((10,119),(55,74)),((23,106),(42,87))))),(((((3,126),(62,67)),((30,99),(35,94))),(((14,115),(51,78)),((19,110),(46,83)))),((((6,123),(59,70)),((27,102),(38,91))),(((11,118),(54,75)),((22,107),(43,86)))))))", "((((((((1,256),(128,129)),((64,193),(65,192))),(((32,225),(97,160)),((33,224),(96,161)))),((((16,241),(113,144)),((49,208),(80,177))),(((17,240),(112,145)),((48,209),(81,176))))),(((((8,249),(121,136)),((57,200),(72,185))),(((25,232),(104,153)),((40,217),(89,168)))),((((9,248),(120,137)),((56,201),(73,184))),(((24,233),(105,152)),((41,216),(88,169)))))),((((((4,253),(125,132)),((61,196),(68,189))),(((29,228),(100,157)),((36,221),(93,164)))),((((13,244),(116,141)),((52,205),(77,180))),(((20,237),(109,148)),((45,212),(84,173))))),(((((5,252),(124,133)),((60,197),(69,188))),(((28,229),(101,156)),((37,220),(92,165)))),((((12,245),(117,140)),((53,204),(76,181))),(((21,236),(108,149)),((44,213),(85,172))))))),(((((((2,255),(127,130)),((63,194),(66,191))),(((31,226),(98,159)),((34,223),(95,162)))),((((15,242),(114,143)),((50,207),(79,178))),(((18,239),(111,146)),((47,210),(82,175))))),(((((7,250),(122,135)),((58,199),(71,186))),(((26,231),(103,154)),((39,218),(90,167)))),((((10,247),(119,138)),((55,202),(74,183))),(((23,234),(106,151)),((42,215),(87,170)))))),((((((3,254),(126,131)),((62,195),(67,190))),(((30,227),(99,158)),((35,222),(94,163)))),((((14,243),(115,142)),((51,206),(78,179))),(((19,238),(110,147)),((46,211),(83,174))))),(((((6,251),(123,134)),((59,198),(70,187))),(((27,230),(102,155)),((38,219),(91,166)))),((((11,246),(118,139)),((54,203),(75,182))),(((22,235),(107,150)),((43,214),(86,171))))))))", "(((((((((1,512),(256,257)),((128,385),(129,384))),(((64,449),(193,320)),((65,448),(192,321)))),((((32,481),(225,288)),((97,416),(160,353))),(((33,480),(224,289)),((96,417),(161,352))))),(((((16,497),(241,272)),((113,400),(144,369))),(((49,464),(208,305)),((80,433),(177,336)))),((((17,496),(240,273)),((112,401),(145,368))),(((48,465),(209,304)),((81,432),(176,337)))))),((((((8,505),(249,264)),((121,392),(136,377))),(((57,456),(200,313)),((72,441),(185,328)))),((((25,488),(232,281)),((104,409),(153,360))),(((40,473),(217,296)),((89,424),(168,345))))),(((((9,504),(248,265)),((120,393),(137,376))),(((56,457),(201,312)),((73,440),(184,329)))),((((24,489),(233,280)),((105,408),(152,361))),(((41,472),(216,297)),((88,425),(169,344))))))),(((((((4,509),(253,260)),((125,388),(132,381))),(((61,452),(196,317)),((68,445),(189,324)))),((((29,484),(228,285)),((100,413),(157,356))),(((36,477),(221,292)),((93,420),(164,349))))),(((((13,500),(244,269)),((116,397),(141,372))),(((52,461),(205,308)),((77,436),(180,333)))),((((20,493),(237,276)),((109,404),(148,365))),(((45,468),(212,301)),((84,429),(173,340)))))),((((((5,508),(252,261)),((124,389),(133,380))),(((60,453),(197,316)),((69,444),(188,325)))),((((28,485),(229,284)),((101,412),(156,357))),(((37,476),(220,293)),((92,421),(165,348))))),(((((12,501),(245,268)),((117,396),(140,373))),(((53,460),(204,309)),((76,437),(181,332)))),((((21,492),(236,277)),((108,405),(149,364))),(((44,469),(213,300)),((85,428),(172,341)))))))),((((((((2,511),(255,258)),((127,386),(130,383))),(((63,450),(194,319)),((66,447),(191,322)))),((((31,482),(226,287)),((98,415),(159,354))),(((34,479),(223,290)),((95,418),(162,351))))),(((((15,498),(242,271)),((114,399),(143,370))),(((50,463),(207,306)),((79,434),(178,335)))),((((18,495),(239,274)),((111,402),(146,367))),(((47,466),(210,303)),((82,431),(175,338)))))),((((((7,506),(250,263)),((122,391),(135,378))),(((58,455),(199,314)),((71,442),(186,327)))),((((26,487),(231,282)),((103,410),(154,359))),(((39,474),(218,295)),((90,423),(167,346))))),(((((10,503),(247,266)),((119,394),(138,375))),(((55,458),(202,311)),((74,439),(183,330)))),((((23,490),(234,279)),((106,407),(151,362))),(((42,471),(215,298)),((87,426),(170,343))))))),(((((((3,510),(254,259)),((126,387),(131,382))),(((62,451),(195,318)),((67,446),(190,323)))),((((30,483),(227,286)),((99,414),(158,355))),(((35,478),(222,291)),((94,419),(163,350))))),(((((14,499),(243,270)),((115,398),(142,371))),(((51,462),(206,307)),((78,435),(179,334)))),((((19,494),(238,275)),((110,403),(147,366))),(((46,467),(211,302)),((83,430),(174,339)))))),((((((6,507),(251,262)),((123,390),(134,379))),(((59,454),(198,315)),((70,443),(187,326)))),((((27,486),(230,283)),((102,411),(155,358))),(((38,475),(219,294)),((91,422),(166,347))))),(((((11,502),(246,267)),((118,395),(139,374))),(((54,459),(203,310)),((75,438),(182,331)))),((((22,491),(235,278)),((107,406),(150,363))),(((43,470),(214,299)),((86,427),(171,342)))))))))", "((((((((((1,1024),(512,513)),((256,769),(257,768))),(((128,897),(385,640)),((129,896),(384,641)))),((((64,961),(449,576)),((193,832),(320,705))),(((65,960),(448,577)),((192,833),(321,704))))),(((((32,993),(481,544)),((225,800),(288,737))),(((97,928),(416,609)),((160,865),(353,672)))),((((33,992),(480,545)),((224,801),(289,736))),(((96,929),(417,608)),((161,864),(352,673)))))),((((((16,1009),(497,528)),((241,784),(272,753))),(((113,912),(400,625)),((144,881),(369,656)))),((((49,976),(464,561)),((208,817),(305,720))),(((80,945),(433,592)),((177,848),(336,689))))),(((((17,1008),(496,529)),((240,785),(273,752))),(((112,913),(401,624)),((145,880),(368,657)))),((((48,977),(465,560)),((209,816),(304,721))),(((81,944),(432,593)),((176,849),(337,688))))))),(((((((8,1017),(505,520)),((249,776),(264,761))),(((121,904),(392,633)),((136,889),(377,648)))),((((57,968),(456,569)),((200,825),(313,712))),(((72,953),(441,584)),((185,840),(328,697))))),(((((25,1000),(488,537)),((232,793),(281,744))),(((104,921),(409,616)),((153,872),(360,665)))),((((40,985),(473,552)),((217,808),(296,729))),(((89,936),(424,601)),((168,857),(345,680)))))),((((((9,1016),(504,521)),((248,777),(265,760))),(((120,905),(393,632)),((137,888),(376,649)))),((((56,969),(457,568)),((201,824),(312,713))),(((73,952),(440,585)),((184,841),(329,696))))),(((((24,1001),(489,536)),((233,792),(280,745))),(((105,920),(408,617)),((152,873),(361,664)))),((((41,984),(472,553)),((216,809),(297,728))),(((88,937),(425,600)),((169,856),(344,681)))))))),((((((((4,1021),(509,516)),((253,772),(260,765))),(((125,900),(388,637)),((132,893),(381,644)))),((((61,964),(452,573)),((196,829),(317,708))),(((68,957),(445,580)),((189,836),(324,701))))),(((((29,996),(484,541)),((228,797),(285,740))),(((100,925),(413,612)),((157,868),(356,669)))),((((36,989),(477,548)),((221,804),(292,733))),(((93,932),(420,605)),((164,861),(349,676)))))),((((((13,1012),(500,525)),((244,781),(269,756))),(((116,909),(397,628)),((141,884),(372,653)))),((((52,973),(461,564)),((205,820),(308,717))),(((77,948),(436,589)),((180,845),(333,692))))),(((((20,1005),(493,532)),((237,788),(276,749))),(((109,916),(404,621)),((148,877),(365,660)))),((((45,980),(468,557)),((212,813),(301,724))),(((84,941),(429,596)),((173,852),(340,685))))))),(((((((5,1020),(508,517)),((252,773),(261,764))),(((124,901),(389,636)),((133,892),(380,645)))),((((60,965),(453,572)),((197,828),(316,709))),(((69,956),(444,581)),((188,837),(325,700))))),(((((28,997),(485,540)),((229,796),(284,741))),(((101,924),(412,613)),((156,869),(357,668)))),((((37,988),(476,549)),((220,805),(293,732))),(((92,933),(421,604)),((165,860),(348,677)))))),((((((12,1013),(501,524)),((245,780),(268,757))),(((117,908),(396,629)),((140,885),(373,652)))),((((53,972),(460,565)),((204,821),(309,716))),(((76,949),(437,588)),((181,844),(332,693))))),(((((21,1004),(492,533)),((236,789),(277,748))),(((108,917),(405,620)),((149,876),(364,661)))),((((44,981),(469,556)),((213,812),(300,725))),(((85,940),(428,597)),((172,853),(341,684))))))))),(((((((((2,1023),(511,514)),((255,770),(258,767))),(((127,898),(386,639)),((130,895),(383,642)))),((((63,962),(450,575)),((194,831),(319,706))),(((66,959),(447,578)),((191,834),(322,703))))),(((((31,994),(482,543)),((226,799),(287,738))),(((98,927),(415,610)),((159,866),(354,671)))),((((34,991),(479,546)),((223,802),(290,735))),(((95,930),(418,607)),((162,863),(351,674)))))),((((((15,1010),(498,527)),((242,783),(271,754))),(((114,911),(399,626)),((143,882),(370,655)))),((((50,975),(463,562)),((207,818),(306,719))),(((79,946),(434,591)),((178,847),(335,690))))),(((((18,1007),(495,530)),((239,786),(274,751))),(((111,914),(402,623)),((146,879),(367,658)))),((((47,978),(466,559)),((210,815),(303,722))),(((82,943),(431,594)),((175,850),(338,687))))))),(((((((7,1018),(506,519)),((250,775),(263,762))),(((122,903),(391,634)),((135,890),(378,647)))),((((58,967),(455,570)),((199,826),(314,711))),(((71,954),(442,583)),((186,839),(327,698))))),(((((26,999),(487,538)),((231,794),(282,743))),(((103,922),(410,615)),((154,871),(359,666)))),((((39,986),(474,551)),((218,807),(295,730))),(((90,935),(423,602)),((167,858),(346,679)))))),((((((10,1015),(503,522)),((247,778),(266,759))),(((119,906),(394,631)),((138,887),(375,650)))),((((55,970),(458,567)),((202,823),(311,714))),(((74,951),(439,586)),((183,842),(330,695))))),(((((23,1002),(490,535)),((234,791),(279,746))),(((106,919),(407,618)),((151,874),(362,663)))),((((42,983),(471,554)),((215,810),(298,727))),(((87,938),(426,599)),((170,855),(343,682)))))))),((((((((3,1022),(510,515)),((254,771),(259,766))),(((126,899),(387,638)),((131,894),(382,643)))),((((62,963),(451,574)),((195,830),(318,707))),(((67,958),(446,579)),((190,835),(323,702))))),(((((30,995),(483,542)),((227,798),(286,739))),(((99,926),(414,611)),((158,867),(355,670)))),((((35,990),(478,547)),((222,803),(291,734))),(((94,931),(419,606)),((163,862),(350,675)))))),((((((14,1011),(499,526)),((243,782),(270,755))),(((115,910),(398,627)),((142,883),(371,654)))),((((51,974),(462,563)),((206,819),(307,718))),(((78,947),(435,590)),((179,846),(334,691))))),(((((19,1006),(494,531)),((238,787),(275,750))),(((110,915),(403,622)),((147,878),(366,659)))),((((46,979),(467,558)),((211,814),(302,723))),(((83,942),(430,595)),((174,851),(339,686))))))),(((((((6,1019),(507,518)),((251,774),(262,763))),(((123,902),(390,635)),((134,891),(379,646)))),((((59,966),(454,571)),((198,827),(315,710))),(((70,955),(443,582)),((187,838),(326,699))))),(((((27,998),(486,539)),((230,795),(283,742))),(((102,923),(411,614)),((155,870),(358,667)))),((((38,987),(475,550)),((219,806),(294,731))),(((91,934),(422,603)),((166,859),(347,678)))))),((((((11,1014),(502,523)),((246,779),(267,758))),(((118,907),(395,630)),((139,886),(374,651)))),((((54,971),(459,566)),((203,822),(310,715))),(((75,950),(438,587)),((182,843),(331,694))))),(((((22,1003),(491,534)),((235,790),(278,747))),(((107,918),(406,619)),((150,875),(363,662)))),((((43,982),(470,555)),((214,811),(299,726))),(((86,939),(427,598)),((171,854),(342,683))))))))))", "(((((((((((1,2048),(1024,1025)),((512,1537),(513,1536))),(((256,1793),(769,1280)),((257,1792),(768,1281)))),((((128,1921),(897,1152)),((385,1664),(640,1409))),(((129,1920),(896,1153)),((384,1665),(641,1408))))),(((((64,1985),(961,1088)),((449,1600),(576,1473))),(((193,1856),(832,1217)),((320,1729),(705,1344)))),((((65,1984),(960,1089)),((448,1601),(577,1472))),(((192,1857),(833,1216)),((321,1728),(704,1345)))))),((((((32,2017),(993,1056)),((481,1568),(544,1505))),(((225,1824),(800,1249)),((288,1761),(737,1312)))),((((97,1952),(928,1121)),((416,1633),(609,1440))),(((160,1889),(865,1184)),((353,1696),(672,1377))))),(((((33,2016),(992,1057)),((480,1569),(545,1504))),(((224,1825),(801,1248)),((289,1760),(736,1313)))),((((96,1953),(929,1120)),((417,1632),(608,1441))),(((161,1888),(864,1185)),((352,1697),(673,1376))))))),(((((((16,2033),(1009,1040)),((497,1552),(528,1521))),(((241,1808),(784,1265)),((272,1777),(753,1296)))),((((113,1936),(912,1137)),((400,1649),(625,1424))),(((144,1905),(881,1168)),((369,1680),(656,1393))))),(((((49,2000),(976,1073)),((464,1585),(561,1488))),(((208,1841),(817,1232)),((305,1744),(720,1329)))),((((80,1969),(945,1104)),((433,1616),(592,1457))),(((177,1872),(848,1201)),((336,1713),(689,1360)))))),((((((17,2032),(1008,1041)),((496,1553),(529,1520))),(((240,1809),(785,1264)),((273,1776),(752,1297)))),((((112,1937),(913,1136)),((401,1648),(624,1425))),(((145,1904),(880,1169)),((368,1681),(657,1392))))),(((((48,2001),(977,1072)),((465,1584),(560,1489))),(((209,1840),(816,1233)),((304,1745),(721,1328)))),((((81,1968),(944,1105)),((432,1617),(593,1456))),(((176,1873),(849,1200)),((337,1712),(688,1361)))))))),((((((((8,2041),(1017,1032)),((505,1544),(520,1529))),(((249,1800),(776,1273)),((264,1785),(761,1288)))),((((121,1928),(904,1145)),((392,1657),(633,1416))),(((136,1913),(889,1160)),((377,1672),(648,1401))))),(((((57,1992),(968,1081)),((456,1593),(569,1480))),(((200,1849),(825,1224)),((313,1736),(712,1337)))),((((72,1977),(953,1096)),((441,1608),(584,1465))),(((185,1864),(840,1209)),((328,1721),(697,1352)))))),((((((25,2024),(1000,1049)),((488,1561),(537,1512))),(((232,1817),(793,1256)),((281,1768),(744,1305)))),((((104,1945),(921,1128)),((409,1640),(616,1433))),(((153,1896),(872,1177)),((360,1689),(665,1384))))),(((((40,2009),(985,1064)),((473,1576),(552,1497))),(((217,1832),(808,1241)),((296,1753),(729,1320)))),((((89,1960),(936,1113)),((424,1625),(601,1448))),(((168,1881),(857,1192)),((345,1704),(680,1369))))))),(((((((9,2040),(1016,1033)),((504,1545),(521,1528))),(((248,1801),(777,1272)),((265,1784),(760,1289)))),((((120,1929),(905,1144)),((393,1656),(632,1417))),(((137,1912),(888,1161)),((376,1673),(649,1400))))),(((((56,1993),(969,1080)),((457,1592),(568,1481))),(((201,1848),(824,1225)),((312,1737),(713,1336)))),((((73,1976),(952,1097)),((440,1609),(585,1464))),(((184,1865),(841,1208)),((329,1720),(696,1353)))))),((((((24,2025),(1001,1048)),((489,1560),(536,1513))),(((233,1816),(792,1257)),((280,1769),(745,1304)))),((((105,1944),(920,1129)),((408,1641),(617,1432))),(((152,1897),(873,1176)),((361,1688),(664,1385))))),(((((41,2008),(984,1065)),((472,1577),(553,1496))),(((216,1833),(809,1240)),((297,1752),(728,1321)))),((((88,1961),(937,1112)),((425,1624),(600,1449))),(((169,1880),(856,1193)),((344,1705),(681,1368))))))))),(((((((((4,2045),(1021,1028)),((509,1540),(516,1533))),(((253,1796),(772,1277)),((260,1789),(765,1284)))),((((125,1924),(900,1149)),((388,1661),(637,1412))),(((132,1917),(893,1156)),((381,1668),(644,1405))))),(((((61,1988),(964,1085)),((452,1597),(573,1476))),(((196,1853),(829,1220)),((317,1732),(708,1341)))),((((68,1981),(957,1092)),((445,1604),(580,1469))),(((189,1860),(836,1213)),((324,1725),(701,1348)))))),((((((29,2020),(996,1053)),((484,1565),(541,1508))),(((228,1821),(797,1252)),((285,1764),(740,1309)))),((((100,1949),(925,1124)),((413,1636),(612,1437))),(((157,1892),(868,1181)),((356,1693),(669,1380))))),(((((36,2013),(989,1060)),((477,1572),(548,1501))),(((221,1828),(804,1245)),((292,1757),(733,1316)))),((((93,1956),(932,1117)),((420,1629),(605,1444))),(((164,1885),(861,1188)),((349,1700),(676,1373))))))),(((((((13,2036),(1012,1037)),((500,1549),(525,1524))),(((244,1805),(781,1268)),((269,1780),(756,1293)))),((((116,1933),(909,1140)),((397,1652),(628,1421))),(((141,1908),(884,1165)),((372,1677),(653,1396))))),(((((52,1997),(973,1076)),((461,1588),(564,1485))),(((205,1844),(820,1229)),((308,1741),(717,1332)))),((((77,1972),(948,1101)),((436,1613),(589,1460))),(((180,1869),(845,1204)),((333,1716),(692,1357)))))),((((((20,2029),(1005,1044)),((493,1556),(532,1517))),(((237,1812),(788,1261)),((276,1773),(749,1300)))),((((109,1940),(916,1133)),((404,1645),(621,1428))),(((148,1901),(877,1172)),((365,1684),(660,1389))))),(((((45,2004),(980,1069)),((468,1581),(557,1492))),(((212,1837),(813,1236)),((301,1748),(724,1325)))),((((84,1965),(941,1108)),((429,1620),(596,1453))),(((173,1876),(852,1197)),((340,1709),(685,1364)))))))),((((((((5,2044),(1020,1029)),((508,1541),(517,1532))),(((252,1797),(773,1276)),((261,1788),(764,1285)))),((((124,1925),(901,1148)),((389,1660),(636,1413))),(((133,1916),(892,1157)),((380,1669),(645,1404))))),(((((60,1989),(965,1084)),((453,1596),(572,1477))),(((197,1852),(828,1221)),((316,1733),(709,1340)))),((((69,1980),(956,1093)),((444,1605),(581,1468))),(((188,1861),(837,1212)),((325,1724),(700,1349)))))),((((((28,2021),(997,1052)),((485,1564),(540,1509))),(((229,1820),(796,1253)),((284,1765),(741,1308)))),((((101,1948),(924,1125)),((412,1637),(613,1436))),(((156,1893),(869,1180)),((357,1692),(668,1381))))),(((((37,2012),(988,1061)),((476,1573),(549,1500))),(((220,1829),(805,1244)),((293,1756),(732,1317)))),((((92,1957),(933,1116)),((421,1628),(604,1445))),(((165,1884),(860,1189)),((348,1701),(677,1372))))))),(((((((12,2037),(1013,1036)),((501,1548),(524,1525))),(((245,1804),(780,1269)),((268,1781),(757,1292)))),((((117,1932),(908,1141)),((396,1653),(629,1420))),(((140,1909),(885,1164)),((373,1676),(652,1397))))),(((((53,1996),(972,1077)),((460,1589),(565,1484))),(((204,1845),(821,1228)),((309,1740),(716,1333)))),((((76,1973),(949,1100)),((437,1612),(588,1461))),(((181,1868),(844,1205)),((332,1717),(693,1356)))))),((((((21,2028),(1004,1045)),((492,1557),(533,1516))),(((236,1813),(789,1260)),((277,1772),(748,1301)))),((((108,1941),(917,1132)),((405,1644),(620,1429))),(((149,1900),(876,1173)),((364,1685),(661,1388))))),(((((44,2005),(981,1068)),((469,1580),(556,1493))),(((213,1836),(812,1237)),((300,1749),(725,1324)))),((((85,1964),(940,1109)),((428,1621),(597,1452))),(((172,1877),(853,1196)),((341,1708),(684,1365)))))))))),((((((((((2,2047),(1023,1026)),((511,1538),(514,1535))),(((255,1794),(770,1279)),((258,1791),(767,1282)))),((((127,1922),(898,1151)),((386,1663),(639,1410))),(((130,1919),(895,1154)),((383,1666),(642,1407))))),(((((63,1986),(962,1087)),((450,1599),(575,1474))),(((194,1855),(831,1218)),((319,1730),(706,1343)))),((((66,1983),(959,1090)),((447,1602),(578,1471))),(((191,1858),(834,1215)),((322,1727),(703,1346)))))),((((((31,2018),(994,1055)),((482,1567),(543,1506))),(((226,1823),(799,1250)),((287,1762),(738,1311)))),((((98,1951),(927,1122)),((415,1634),(610,1439))),(((159,1890),(866,1183)),((354,1695),(671,1378))))),(((((34,2015),(991,1058)),((479,1570),(546,1503))),(((223,1826),(802,1247)),((290,1759),(735,1314)))),((((95,1954),(930,1119)),((418,1631),(607,1442))),(((162,1887),(863,1186)),((351,1698),(674,1375))))))),(((((((15,2034),(1010,1039)),((498,1551),(527,1522))),(((242,1807),(783,1266)),((271,1778),(754,1295)))),((((114,1935),(911,1138)),((399,1650),(626,1423))),(((143,1906),(882,1167)),((370,1679),(655,1394))))),(((((50,1999),(975,1074)),((463,1586),(562,1487))),(((207,1842),(818,1231)),((306,1743),(719,1330)))),((((79,1970),(946,1103)),((434,1615),(591,1458))),(((178,1871),(847,1202)),((335,1714),(690,1359)))))),((((((18,2031),(1007,1042)),((495,1554),(530,1519))),(((239,1810),(786,1263)),((274,1775),(751,1298)))),((((111,1938),(914,1135)),((402,1647),(623,1426))),(((146,1903),(879,1170)),((367,1682),(658,1391))))),(((((47,2002),(978,1071)),((466,1583),(559,1490))),(((210,1839),(815,1234)),((303,1746),(722,1327)))),((((82,1967),(943,1106)),((431,1618),(594,1455))),(((175,1874),(850,1199)),((338,1711),(687,1362)))))))),((((((((7,2042),(1018,1031)),((506,1543),(519,1530))),(((250,1799),(775,1274)),((263,1786),(762,1287)))),((((122,1927),(903,1146)),((391,1658),(634,1415))),(((135,1914),(890,1159)),((378,1671),(647,1402))))),(((((58,1991),(967,1082)),((455,1594),(570,1479))),(((199,1850),(826,1223)),((314,1735),(711,1338)))),((((71,1978),(954,1095)),((442,1607),(583,1466))),(((186,1863),(839,1210)),((327,1722),(698,1351)))))),((((((26,2023),(999,1050)),((487,1562),(538,1511))),(((231,1818),(794,1255)),((282,1767),(743,1306)))),((((103,1946),(922,1127)),((410,1639),(615,1434))),(((154,1895),(871,1178)),((359,1690),(666,1383))))),(((((39,2010),(986,1063)),((474,1575),(551,1498))),(((218,1831),(807,1242)),((295,1754),(730,1319)))),((((90,1959),(935,1114)),((423,1626),(602,1447))),(((167,1882),(858,1191)),((346,1703),(679,1370))))))),(((((((10,2039),(1015,1034)),((503,1546),(522,1527))),(((247,1802),(778,1271)),((266,1783),(759,1290)))),((((119,1930),(906,1143)),((394,1655),(631,1418))),(((138,1911),(887,1162)),((375,1674),(650,1399))))),(((((55,1994),(970,1079)),((458,1591),(567,1482))),(((202,1847),(823,1226)),((311,1738),(714,1335)))),((((74,1975),(951,1098)),((439,1610),(586,1463))),(((183,1866),(842,1207)),((330,1719),(695,1354)))))),((((((23,2026),(1002,1047)),((490,1559),(535,1514))),(((234,1815),(791,1258)),((279,1770),(746,1303)))),((((106,1943),(919,1130)),((407,1642),(618,1431))),(((151,1898),(874,1175)),((362,1687),(663,1386))))),(((((42,2007),(983,1066)),((471,1578),(554,1495))),(((215,1834),(810,1239)),((298,1751),(727,1322)))),((((87,1962),(938,1111)),((426,1623),(599,1450))),(((170,1879),(855,1194)),((343,1706),(682,1367))))))))),(((((((((3,2046),(1022,1027)),((510,1539),(515,1534))),(((254,1795),(771,1278)),((259,1790),(766,1283)))),((((126,1923),(899,1150)),((387,1662),(638,1411))),(((131,1918),(894,1155)),((382,1667),(643,1406))))),(((((62,1987),(963,1086)),((451,1598),(574,1475))),(((195,1854),(830,1219)),((318,1731),(707,1342)))),((((67,1982),(958,1091)),((446,1603),(579,1470))),(((190,1859),(835,1214)),((323,1726),(702,1347)))))),((((((30,2019),(995,1054)),((483,1566),(542,1507))),(((227,1822),(798,1251)),((286,1763),(739,1310)))),((((99,1950),(926,1123)),((414,1635),(611,1438))),(((158,1891),(867,1182)),((355,1694),(670,1379))))),(((((35,2014),(990,1059)),((478,1571),(547,1502))),(((222,1827),(803,1246)),((291,1758),(734,1315)))),((((94,1955),(931,1118)),((419,1630),(606,1443))),(((163,1886),(862,1187)),((350,1699),(675,1374))))))),(((((((14,2035),(1011,1038)),((499,1550),(526,1523))),(((243,1806),(782,1267)),((270,1779),(755,1294)))),((((115,1934),(910,1139)),((398,1651),(627,1422))),(((142,1907),(883,1166)),((371,1678),(654,1395))))),(((((51,1998),(974,1075)),((462,1587),(563,1486))),(((206,1843),(819,1230)),((307,1742),(718,1331)))),((((78,1971),(947,1102)),((435,1614),(590,1459))),(((179,1870),(846,1203)),((334,1715),(691,1358)))))),((((((19,2030),(1006,1043)),((494,1555),(531,1518))),(((238,1811),(787,1262)),((275,1774),(750,1299)))),((((110,1939),(915,1134)),((403,1646),(622,1427))),(((147,1902),(878,1171)),((366,1683),(659,1390))))),(((((46,2003),(979,1070)),((467,1582),(558,1491))),(((211,1838),(814,1235)),((302,1747),(723,1326)))),((((83,1966),(942,1107)),((430,1619),(595,1454))),(((174,1875),(851,1198)),((339,1710),(686,1363)))))))),((((((((6,2043),(1019,1030)),((507,1542),(518,1531))),(((251,1798),(774,1275)),((262,1787),(763,1286)))),((((123,1926),(902,1147)),((390,1659),(635,1414))),(((134,1915),(891,1158)),((379,1670),(646,1403))))),(((((59,1990),(966,1083)),((454,1595),(571,1478))),(((198,1851),(827,1222)),((315,1734),(710,1339)))),((((70,1979),(955,1094)),((443,1606),(582,1467))),(((187,1862),(838,1211)),((326,1723),(699,1350)))))),((((((27,2022),(998,1051)),((486,1563),(539,1510))),(((230,1819),(795,1254)),((283,1766),(742,1307)))),((((102,1947),(923,1126)),((411,1638),(614,1435))),(((155,1894),(870,1179)),((358,1691),(667,1382))))),(((((38,2011),(987,1062)),((475,1574),(550,1499))),(((219,1830),(806,1243)),((294,1755),(731,1318)))),((((91,1958),(934,1115)),((422,1627),(603,1446))),(((166,1883),(859,1190)),((347,1702),(678,1371))))))),(((((((11,2038),(1014,1035)),((502,1547),(523,1526))),(((246,1803),(779,1270)),((267,1782),(758,1291)))),((((118,1931),(907,1142)),((395,1654),(630,1419))),(((139,1910),(886,1163)),((374,1675),(651,1398))))),(((((54,1995),(971,1078)),((459,1590),(566,1483))),(((203,1846),(822,1227)),((310,1739),(715,1334)))),((((75,1974),(950,1099)),((438,1611),(587,1462))),(((182,1867),(843,1206)),((331,1718),(694,1355)))))),((((((22,2027),(1003,1046)),((491,1558),(534,1515))),(((235,1814),(790,1259)),((278,1771),(747,1302)))),((((107,1942),(918,1131)),((406,1643),(619,1430))),(((150,1899),(875,1174)),((363,1686),(662,1387))))),(((((43,2006),(982,1067)),((470,1579),(555,1494))),(((214,1835),(811,1238)),((299,1750),(726,1323)))),((((86,1963),(939,1110)),((427,1622),(598,1451))),(((171,1878),(854,1195)),((342,1707),(683,1366)))))))))))", "((((((((((((1,4096),(2048,2049)),((1024,3073),(1025,3072))),(((512,3585),(1537,2560)),((513,3584),(1536,2561)))),((((256,3841),(1793,2304)),((769,3328),(1280,2817))),(((257,3840),(1792,2305)),((768,3329),(1281,2816))))),(((((128,3969),(1921,2176)),((897,3200),(1152,2945))),(((385,3712),(1664,2433)),((640,3457),(1409,2688)))),((((129,3968),(1920,2177)),((896,3201),(1153,2944))),(((384,3713),(1665,2432)),((641,3456),(1408,2689)))))),((((((64,4033),(1985,2112)),((961,3136),(1088,3009))),(((449,3648),(1600,2497)),((576,3521),(1473,2624)))),((((193,3904),(1856,2241)),((832,3265),(1217,2880))),(((320,3777),(1729,2368)),((705,3392),(1344,2753))))),(((((65,4032),(1984,2113)),((960,3137),(1089,3008))),(((448,3649),(1601,2496)),((577,3520),(1472,2625)))),((((192,3905),(1857,2240)),((833,3264),(1216,2881))),(((321,3776),(1728,2369)),((704,3393),(1345,2752))))))),(((((((32,4065),(2017,2080)),((993,3104),(1056,3041))),(((481,3616),(1568,2529)),((544,3553),(1505,2592)))),((((225,3872),(1824,2273)),((800,3297),(1249,2848))),(((288,3809),(1761,2336)),((737,3360),(1312,2785))))),(((((97,4000),(1952,2145)),((928,3169),(1121,2976))),(((416,3681),(1633,2464)),((609,3488),(1440,2657)))),((((160,3937),(1889,2208)),((865,3232),(1184,2913))),(((353,3744),(1696,2401)),((672,3425),(1377,2720)))))),((((((33,4064),(2016,2081)),((992,3105),(1057,3040))),(((480,3617),(1569,2528)),((545,3552),(1504,2593)))),((((224,3873),(1825,2272)),((801,3296),(1248,2849))),(((289,3808),(1760,2337)),((736,3361),(1313,2784))))),(((((96,4001),(1953,2144)),((929,3168),(1120,2977))),(((417,3680),(1632,2465)),((608,3489),(1441,2656)))),((((161,3936),(1888,2209)),((864,3233),(1185,2912))),(((352,3745),(1697,2400)),((673,3424),(1376,2721)))))))),((((((((16,4081),(2033,2064)),((1009,3088),(1040,3057))),(((497,3600),(1552,2545)),((528,3569),(1521,2576)))),((((241,3856),(1808,2289)),((784,3313),(1265,2832))),(((272,3825),(1777,2320)),((753,3344),(1296,2801))))),(((((113,3984),(1936,2161)),((912,3185),(1137,2960))),(((400,3697),(1649,2448)),((625,3472),(1424,2673)))),((((144,3953),(1905,2192)),((881,3216),(1168,2929))),(((369,3728),(1680,2417)),((656,3441),(1393,2704)))))),((((((49,4048),(2000,2097)),((976,3121),(1073,3024))),(((464,3633),(1585,2512)),((561,3536),(1488,2609)))),((((208,3889),(1841,2256)),((817,3280),(1232,2865))),(((305,3792),(1744,2353)),((720,3377),(1329,2768))))),(((((80,4017),(1969,2128)),((945,3152),(1104,2993))),(((433,3664),(1616,2481)),((592,3505),(1457,2640)))),((((177,3920),(1872,2225)),((848,3249),(1201,2896))),(((336,3761),(1713,2384)),((689,3408),(1360,2737))))))),(((((((17,4080),(2032,2065)),((1008,3089),(1041,3056))),(((496,3601),(1553,2544)),((529,3568),(1520,2577)))),((((240,3857),(1809,2288)),((785,3312),(1264,2833))),(((273,3824),(1776,2321)),((752,3345),(1297,2800))))),(((((112,3985),(1937,2160)),((913,3184),(1136,2961))),(((401,3696),(1648,2449)),((624,3473),(1425,2672)))),((((145,3952),(1904,2193)),((880,3217),(1169,2928))),(((368,3729),(1681,2416)),((657,3440),(1392,2705)))))),((((((48,4049),(2001,2096)),((977,3120),(1072,3025))),(((465,3632),(1584,2513)),((560,3537),(1489,2608)))),((((209,3888),(1840,2257)),((816,3281),(1233,2864))),(((304,3793),(1745,2352)),((721,3376),(1328,2769))))),(((((81,4016),(1968,2129)),((944,3153),(1105,2992))),(((432,3665),(1617,2480)),((593,3504),(1456,2641)))),((((176,3921),(1873,2224)),((849,3248),(1200,2897))),(((337,3760),(1712,2385)),((688,3409),(1361,2736))))))))),(((((((((8,4089),(2041,2056)),((1017,3080),(1032,3065))),(((505,3592),(1544,2553)),((520,3577),(1529,2568)))),((((249,3848),(1800,2297)),((776,3321),(1273,2824))),(((264,3833),(1785,2312)),((761,3336),(1288,2809))))),(((((121,3976),(1928,2169)),((904,3193),(1145,2952))),(((392,3705),(1657,2440)),((633,3464),(1416,2681)))),((((136,3961),(1913,2184)),((889,3208),(1160,2937))),(((377,3720),(1672,2425)),((648,3449),(1401,2696)))))),((((((57,4040),(1992,2105)),((968,3129),(1081,3016))),(((456,3641),(1593,2504)),((569,3528),(1480,2617)))),((((200,3897),(1849,2248)),((825,3272),(1224,2873))),(((313,3784),(1736,2361)),((712,3385),(1337,2760))))),(((((72,4025),(1977,2120)),((953,3144),(1096,3001))),(((441,3656),(1608,2489)),((584,3513),(1465,2632)))),((((185,3912),(1864,2233)),((840,3257),(1209,2888))),(((328,3769),(1721,2376)),((697,3400),(1352,2745))))))),(((((((25,4072),(2024,2073)),((1000,3097),(1049,3048))),(((488,3609),(1561,2536)),((537,3560),(1512,2585)))),((((232,3865),(1817,2280)),((793,3304),(1256,2841))),(((281,3816),(1768,2329)),((744,3353),(1305,2792))))),(((((104,3993),(1945,2152)),((921,3176),(1128,2969))),(((409,3688),(1640,2457)),((616,3481),(1433,2664)))),((((153,3944),(1896,2201)),((872,3225),(1177,2920))),(((360,3737),(1689,2408)),((665,3432),(1384,2713)))))),((((((40,4057),(2009,2088)),((985,3112),(1064,3033))),(((473,3624),(1576,2521)),((552,3545),(1497,2600)))),((((217,3880),(1832,2265)),((808,3289),(1241,2856))),(((296,3801),(1753,2344)),((729,3368),(1320,2777))))),(((((89,4008),(1960,2137)),((936,3161),(1113,2984))),(((424,3673),(1625,2472)),((601,3496),(1448,2649)))),((((168,3929),(1881,2216)),((857,3240),(1192,2905))),(((345,3752),(1704,2393)),((680,3417),(1369,2728)))))))),((((((((9,4088),(2040,2057)),((1016,3081),(1033,3064))),(((504,3593),(1545,2552)),((521,3576),(1528,2569)))),((((248,3849),(1801,2296)),((777,3320),(1272,2825))),(((265,3832),(1784,2313)),((760,3337),(1289,2808))))),(((((120,3977),(1929,2168)),((905,3192),(1144,2953))),(((393,3704),(1656,2441)),((632,3465),(1417,2680)))),((((137,3960),(1912,2185)),((888,3209),(1161,2936))),(((376,3721),(1673,2424)),((649,3448),(1400,2697)))))),((((((56,4041),(1993,2104)),((969,3128),(1080,3017))),(((457,3640),(1592,2505)),((568,3529),(1481,2616)))),((((201,3896),(1848,2249)),((824,3273),(1225,2872))),(((312,3785),(1737,2360)),((713,3384),(1336,2761))))),(((((73,4024),(1976,2121)),((952,3145),(1097,3000))),(((440,3657),(1609,2488)),((585,3512),(1464,2633)))),((((184,3913),(1865,2232)),((841,3256),(1208,2889))),(((329,3768),(1720,2377)),((696,3401),(1353,2744))))))),(((((((24,4073),(2025,2072)),((1001,3096),(1048,3049))),(((489,3608),(1560,2537)),((536,3561),(1513,2584)))),((((233,3864),(1816,2281)),((792,3305),(1257,2840))),(((280,3817),(1769,2328)),((745,3352),(1304,2793))))),(((((105,3992),(1944,2153)),((920,3177),(1129,2968))),(((408,3689),(1641,2456)),((617,3480),(1432,2665)))),((((152,3945),(1897,2200)),((873,3224),(1176,2921))),(((361,3736),(1688,2409)),((664,3433),(1385,2712)))))),((((((41,4056),(2008,2089)),((984,3113),(1065,3032))),(((472,3625),(1577,2520)),((553,3544),(1496,2601)))),((((216,3881),(1833,2264)),((809,3288),(1240,2857))),(((297,3800),(1752,2345)),((728,3369),(1321,2776))))),(((((88,4009),(1961,2136)),((937,3160),(1112,2985))),(((425,3672),(1624,2473)),((600,3497),(1449,2648)))),((((169,3928),(1880,2217)),((856,3241),(1193,2904))),(((344,3753),(1705,2392)),((681,3416),(1368,2729)))))))))),((((((((((4,4093),(2045,2052)),((1021,3076),(1028,3069))),(((509,3588),(1540,2557)),((516,3581),(1533,2564)))),((((253,3844),(1796,2301)),((772,3325),(1277,2820))),(((260,3837),(1789,2308)),((765,3332),(1284,2813))))),(((((125,3972),(1924,2173)),((900,3197),(1149,2948))),(((388,3709),(1661,2436)),((637,3460),(1412,2685)))),((((132,3965),(1917,2180)),((893,3204),(1156,2941))),(((381,3716),(1668,2429)),((644,3453),(1405,2692)))))),((((((61,4036),(1988,2109)),((964,3133),(1085,3012))),(((452,3645),(1597,2500)),((573,3524),(1476,2621)))),((((196,3901),(1853,2244)),((829,3268),(1220,2877))),(((317,3780),(1732,2365)),((708,3389),(1341,2756))))),(((((68,4029),(1981,2116)),((957,3140),(1092,3005))),(((445,3652),(1604,2493)),((580,3517),(1469,2628)))),((((189,3908),(1860,2237)),((836,3261),(1213,2884))),(((324,3773),(1725,2372)),((701,3396),(1348,2749))))))),(((((((29,4068),(2020,2077)),((996,3101),(1053,3044))),(((484,3613),(1565,2532)),((541,3556),(1508,2589)))),((((228,3869),(1821,2276)),((797,3300),(1252,2845))),(((285,3812),(1764,2333)),((740,3357),(1309,2788))))),(((((100,3997),(1949,2148)),((925,3172),(1124,2973))),(((413,3684),(1636,2461)),((612,3485),(1437,2660)))),((((157,3940),(1892,2205)),((868,3229),(1181,2916))),(((356,3741),(1693,2404)),((669,3428),(1380,2717)))))),((((((36,4061),(2013,2084)),((989,3108),(1060,3037))),(((477,3620),(1572,2525)),((548,3549),(1501,2596)))),((((221,3876),(1828,2269)),((804,3293),(1245,2852))),(((292,3805),(1757,2340)),((733,3364),(1316,2781))))),(((((93,4004),(1956,2141)),((932,3165),(1117,2980))),(((420,3677),(1629,2468)),((605,3492),(1444,2653)))),((((164,3933),(1885,2212)),((861,3236),(1188,2909))),(((349,3748),(1700,2397)),((676,3421),(1373,2724)))))))),((((((((13,4084),(2036,2061)),((1012,3085),(1037,3060))),(((500,3597),(1549,2548)),((525,3572),(1524,2573)))),((((244,3853),(1805,2292)),((781,3316),(1268,2829))),(((269,3828),(1780,2317)),((756,3341),(1293,2804))))),(((((116,3981),(1933,2164)),((909,3188),(1140,2957))),(((397,3700),(1652,2445)),((628,3469),(1421,2676)))),((((141,3956),(1908,2189)),((884,3213),(1165,2932))),(((372,3725),(1677,2420)),((653,3444),(1396,2701)))))),((((((52,4045),(1997,2100)),((973,3124),(1076,3021))),(((461,3636),(1588,2509)),((564,3533),(1485,2612)))),((((205,3892),(1844,2253)),((820,3277),(1229,2868))),(((308,3789),(1741,2356)),((717,3380),(1332,2765))))),(((((77,4020),(1972,2125)),((948,3149),(1101,2996))),(((436,3661),(1613,2484)),((589,3508),(1460,2637)))),((((180,3917),(1869,2228)),((845,3252),(1204,2893))),(((333,3764),(1716,2381)),((692,3405),(1357,2740))))))),(((((((20,4077),(2029,2068)),((1005,3092),(1044,3053))),(((493,3604),(1556,2541)),((532,3565),(1517,2580)))),((((237,3860),(1812,2285)),((788,3309),(1261,2836))),(((276,3821),(1773,2324)),((749,3348),(1300,2797))))),(((((109,3988),(1940,2157)),((916,3181),(1133,2964))),(((404,3693),(1645,2452)),((621,3476),(1428,2669)))),((((148,3949),(1901,2196)),((877,3220),(1172,2925))),(((365,3732),(1684,2413)),((660,3437),(1389,2708)))))),((((((45,4052),(2004,2093)),((980,3117),(1069,3028))),(((468,3629),(1581,2516)),((557,3540),(1492,2605)))),((((212,3885),(1837,2260)),((813,3284),(1236,2861))),(((301,3796),(1748,2349)),((724,3373),(1325,2772))))),(((((84,4013),(1965,2132)),((941,3156),(1108,2989))),(((429,3668),(1620,2477)),((596,3501),(1453,2644)))),((((173,3924),(1876,2221)),((852,3245),(1197,2900))),(((340,3757),(1709,2388)),((685,3412),(1364,2733))))))))),(((((((((5,4092),(2044,2053)),((1020,3077),(1029,3068))),(((508,3589),(1541,2556)),((517,3580),(1532,2565)))),((((252,3845),(1797,2300)),((773,3324),(1276,2821))),(((261,3836),(1788,2309)),((764,3333),(1285,2812))))),(((((124,3973),(1925,2172)),((901,3196),(1148,2949))),(((389,3708),(1660,2437)),((636,3461),(1413,2684)))),((((133,3964),(1916,2181)),((892,3205),(1157,2940))),(((380,3717),(1669,2428)),((645,3452),(1404,2693)))))),((((((60,4037),(1989,2108)),((965,3132),(1084,3013))),(((453,3644),(1596,2501)),((572,3525),(1477,2620)))),((((197,3900),(1852,2245)),((828,3269),(1221,2876))),(((316,3781),(1733,2364)),((709,3388),(1340,2757))))),(((((69,4028),(1980,2117)),((956,3141),(1093,3004))),(((444,3653),(1605,2492)),((581,3516),(1468,2629)))),((((188,3909),(1861,2236)),((837,3260),(1212,2885))),(((325,3772),(1724,2373)),((700,3397),(1349,2748))))))),(((((((28,4069),(2021,2076)),((997,3100),(1052,3045))),(((485,3612),(1564,2533)),((540,3557),(1509,2588)))),((((229,3868),(1820,2277)),((796,3301),(1253,2844))),(((284,3813),(1765,2332)),((741,3356),(1308,2789))))),(((((101,3996),(1948,2149)),((924,3173),(1125,2972))),(((412,3685),(1637,2460)),((613,3484),(1436,2661)))),((((156,3941),(1893,2204)),((869,3228),(1180,2917))),(((357,3740),(1692,2405)),((668,3429),(1381,2716)))))),((((((37,4060),(2012,2085)),((988,3109),(1061,3036))),(((476,3621),(1573,2524)),((549,3548),(1500,2597)))),((((220,3877),(1829,2268)),((805,3292),(1244,2853))),(((293,3804),(1756,2341)),((732,3365),(1317,2780))))),(((((92,4005),(1957,2140)),((933,3164),(1116,2981))),(((421,3676),(1628,2469)),((604,3493),(1445,2652)))),((((165,3932),(1884,2213)),((860,3237),(1189,2908))),(((348,3749),(1701,2396)),((677,3420),(1372,2725)))))))),((((((((12,4085),(2037,2060)),((1013,3084),(1036,3061))),(((501,3596),(1548,2549)),((524,3573),(1525,2572)))),((((245,3852),(1804,2293)),((780,3317),(1269,2828))),(((268,3829),(1781,2316)),((757,3340),(1292,2805))))),(((((117,3980),(1932,2165)),((908,3189),(1141,2956))),(((396,3701),(1653,2444)),((629,3468),(1420,2677)))),((((140,3957),(1909,2188)),((885,3212),(1164,2933))),(((373,3724),(1676,2421)),((652,3445),(1397,2700)))))),((((((53,4044),(1996,2101)),((972,3125),(1077,3020))),(((460,3637),(1589,2508)),((565,3532),(1484,2613)))),((((204,3893),(1845,2252)),((821,3276),(1228,2869))),(((309,3788),(1740,2357)),((716,3381),(1333,2764))))),(((((76,4021),(1973,2124)),((949,3148),(1100,2997))),(((437,3660),(1612,2485)),((588,3509),(1461,2636)))),((((181,3916),(1868,2229)),((844,3253),(1205,2892))),(((332,3765),(1717,2380)),((693,3404),(1356,2741))))))),(((((((21,4076),(2028,2069)),((1004,3093),(1045,3052))),(((492,3605),(1557,2540)),((533,3564),(1516,2581)))),((((236,3861),(1813,2284)),((789,3308),(1260,2837))),(((277,3820),(1772,2325)),((748,3349),(1301,2796))))),(((((108,3989),(1941,2156)),((917,3180),(1132,2965))),(((405,3692),(1644,2453)),((620,3477),(1429,2668)))),((((149,3948),(1900,2197)),((876,3221),(1173,2924))),(((364,3733),(1685,2412)),((661,3436),(1388,2709)))))),((((((44,4053),(2005,2092)),((981,3116),(1068,3029))),(((469,3628),(1580,2517)),((556,3541),(1493,2604)))),((((213,3884),(1836,2261)),((812,3285),(1237,2860))),(((300,3797),(1749,2348)),((725,3372),(1324,2773))))),(((((85,4012),(1964,2133)),((940,3157),(1109,2988))),(((428,3669),(1621,2476)),((597,3500),(1452,2645)))),((((172,3925),(1877,2220)),((853,3244),(1196,2901))),(((341,3756),(1708,2389)),((684,3413),(1365,2732))))))))))),(((((((((((2,4095),(2047,2050)),((1023,3074),(1026,3071))),(((511,3586),(1538,2559)),((514,3583),(1535,2562)))),((((255,3842),(1794,2303)),((770,3327),(1279,2818))),(((258,3839),(1791,2306)),((767,3330),(1282,2815))))),(((((127,3970),(1922,2175)),((898,3199),(1151,2946))),(((386,3711),(1663,2434)),((639,3458),(1410,2687)))),((((130,3967),(1919,2178)),((895,3202),(1154,2943))),(((383,3714),(1666,2431)),((642,3455),(1407,2690)))))),((((((63,4034),(1986,2111)),((962,3135),(1087,3010))),(((450,3647),(1599,2498)),((575,3522),(1474,2623)))),((((194,3903),(1855,2242)),((831,3266),(1218,2879))),(((319,3778),(1730,2367)),((706,3391),(1343,2754))))),(((((66,4031),(1983,2114)),((959,3138),(1090,3007))),(((447,3650),(1602,2495)),((578,3519),(1471,2626)))),((((191,3906),(1858,2239)),((834,3263),(1215,2882))),(((322,3775),(1727,2370)),((703,3394),(1346,2751))))))),(((((((31,4066),(2018,2079)),((994,3103),(1055,3042))),(((482,3615),(1567,2530)),((543,3554),(1506,2591)))),((((226,3871),(1823,2274)),((799,3298),(1250,2847))),(((287,3810),(1762,2335)),((738,3359),(1311,2786))))),(((((98,3999),(1951,2146)),((927,3170),(1122,2975))),(((415,3682),(1634,2463)),((610,3487),(1439,2658)))),((((159,3938),(1890,2207)),((866,3231),(1183,2914))),(((354,3743),(1695,2402)),((671,3426),(1378,2719)))))),((((((34,4063),(2015,2082)),((991,3106),(1058,3039))),(((479,3618),(1570,2527)),((546,3551),(1503,2594)))),((((223,3874),(1826,2271)),((802,3295),(1247,2850))),(((290,3807),(1759,2338)),((735,3362),(1314,2783))))),(((((95,4002),(1954,2143)),((930,3167),(1119,2978))),(((418,3679),(1631,2466)),((607,3490),(1442,2655)))),((((162,3935),(1887,2210)),((863,3234),(1186,2911))),(((351,3746),(1698,2399)),((674,3423),(1375,2722)))))))),((((((((15,4082),(2034,2063)),((1010,3087),(1039,3058))),(((498,3599),(1551,2546)),((527,3570),(1522,2575)))),((((242,3855),(1807,2290)),((783,3314),(1266,2831))),(((271,3826),(1778,2319)),((754,3343),(1295,2802))))),(((((114,3983),(1935,2162)),((911,3186),(1138,2959))),(((399,3698),(1650,2447)),((626,3471),(1423,2674)))),((((143,3954),(1906,2191)),((882,3215),(1167,2930))),(((370,3727),(1679,2418)),((655,3442),(1394,2703)))))),((((((50,4047),(1999,2098)),((975,3122),(1074,3023))),(((463,3634),(1586,2511)),((562,3535),(1487,2610)))),((((207,3890),(1842,2255)),((818,3279),(1231,2866))),(((306,3791),(1743,2354)),((719,3378),(1330,2767))))),(((((79,4018),(1970,2127)),((946,3151),(1103,2994))),(((434,3663),(1615,2482)),((591,3506),(1458,2639)))),((((178,3919),(1871,2226)),((847,3250),(1202,2895))),(((335,3762),(1714,2383)),((690,3407),(1359,2738))))))),(((((((18,4079),(2031,2066)),((1007,3090),(1042,3055))),(((495,3602),(1554,2543)),((530,3567),(1519,2578)))),((((239,3858),(1810,2287)),((786,3311),(1263,2834))),(((274,3823),(1775,2322)),((751,3346),(1298,2799))))),(((((111,3986),(1938,2159)),((914,3183),(1135,2962))),(((402,3695),(1647,2450)),((623,3474),(1426,2671)))),((((146,3951),(1903,2194)),((879,3218),(1170,2927))),(((367,3730),(1682,2415)),((658,3439),(1391,2706)))))),((((((47,4050),(2002,2095)),((978,3119),(1071,3026))),(((466,3631),(1583,2514)),((559,3538),(1490,2607)))),((((210,3887),(1839,2258)),((815,3282),(1234,2863))),(((303,3794),(1746,2351)),((722,3375),(1327,2770))))),(((((82,4015),(1967,2130)),((943,3154),(1106,2991))),(((431,3666),(1618,2479)),((594,3503),(1455,2642)))),((((175,3922),(1874,2223)),((850,3247),(1199,2898))),(((338,3759),(1711,2386)),((687,3410),(1362,2735))))))))),(((((((((7,4090),(2042,2055)),((1018,3079),(1031,3066))),(((506,3591),(1543,2554)),((519,3578),(1530,2567)))),((((250,3847),(1799,2298)),((775,3322),(1274,2823))),(((263,3834),(1786,2311)),((762,3335),(1287,2810))))),(((((122,3975),(1927,2170)),((903,3194),(1146,2951))),(((391,3706),(1658,2439)),((634,3463),(1415,2682)))),((((135,3962),(1914,2183)),((890,3207),(1159,2938))),(((378,3719),(1671,2426)),((647,3450),(1402,2695)))))),((((((58,4039),(1991,2106)),((967,3130),(1082,3015))),(((455,3642),(1594,2503)),((570,3527),(1479,2618)))),((((199,3898),(1850,2247)),((826,3271),(1223,2874))),(((314,3783),(1735,2362)),((711,3386),(1338,2759))))),(((((71,4026),(1978,2119)),((954,3143),(1095,3002))),(((442,3655),(1607,2490)),((583,3514),(1466,2631)))),((((186,3911),(1863,2234)),((839,3258),(1210,2887))),(((327,3770),(1722,2375)),((698,3399),(1351,2746))))))),(((((((26,4071),(2023,2074)),((999,3098),(1050,3047))),(((487,3610),(1562,2535)),((538,3559),(1511,2586)))),((((231,3866),(1818,2279)),((794,3303),(1255,2842))),(((282,3815),(1767,2330)),((743,3354),(1306,2791))))),(((((103,3994),(1946,2151)),((922,3175),(1127,2970))),(((410,3687),(1639,2458)),((615,3482),(1434,2663)))),((((154,3943),(1895,2202)),((871,3226),(1178,2919))),(((359,3738),(1690,2407)),((666,3431),(1383,2714)))))),((((((39,4058),(2010,2087)),((986,3111),(1063,3034))),(((474,3623),(1575,2522)),((551,3546),(1498,2599)))),((((218,3879),(1831,2266)),((807,3290),(1242,2855))),(((295,3802),(1754,2343)),((730,3367),(1319,2778))))),(((((90,4007),(1959,2138)),((935,3162),(1114,2983))),(((423,3674),(1626,2471)),((602,3495),(1447,2650)))),((((167,3930),(1882,2215)),((858,3239),(1191,2906))),(((346,3751),(1703,2394)),((679,3418),(1370,2727)))))))),((((((((10,4087),(2039,2058)),((1015,3082),(1034,3063))),(((503,3594),(1546,2551)),((522,3575),(1527,2570)))),((((247,3850),(1802,2295)),((778,3319),(1271,2826))),(((266,3831),(1783,2314)),((759,3338),(1290,2807))))),(((((119,3978),(1930,2167)),((906,3191),(1143,2954))),(((394,3703),(1655,2442)),((631,3466),(1418,2679)))),((((138,3959),(1911,2186)),((887,3210),(1162,2935))),(((375,3722),(1674,2423)),((650,3447),(1399,2698)))))),((((((55,4042),(1994,2103)),((970,3127),(1079,3018))),(((458,3639),(1591,2506)),((567,3530),(1482,2615)))),((((202,3895),(1847,2250)),((823,3274),(1226,2871))),(((311,3786),(1738,2359)),((714,3383),(1335,2762))))),(((((74,4023),(1975,2122)),((951,3146),(1098,2999))),(((439,3658),(1610,2487)),((586,3511),(1463,2634)))),((((183,3914),(1866,2231)),((842,3255),(1207,2890))),(((330,3767),(1719,2378)),((695,3402),(1354,2743))))))),(((((((23,4074),(2026,2071)),((1002,3095),(1047,3050))),(((490,3607),(1559,2538)),((535,3562),(1514,2583)))),((((234,3863),(1815,2282)),((791,3306),(1258,2839))),(((279,3818),(1770,2327)),((746,3351),(1303,2794))))),(((((106,3991),(1943,2154)),((919,3178),(1130,2967))),(((407,3690),(1642,2455)),((618,3479),(1431,2666)))),((((151,3946),(1898,2199)),((874,3223),(1175,2922))),(((362,3735),(1687,2410)),((663,3434),(1386,2711)))))),((((((42,4055),(2007,2090)),((983,3114),(1066,3031))),(((471,3626),(1578,2519)),((554,3543),(1495,2602)))),((((215,3882),(1834,2263)),((810,3287),(1239,2858))),(((298,3799),(1751,2346)),((727,3370),(1322,2775))))),(((((87,4010),(1962,2135)),((938,3159),(1111,2986))),(((426,3671),(1623,2474)),((599,3498),(1450,2647)))),((((170,3927),(1879,2218)),((855,3242),(1194,2903))),(((343,3754),(1706,2391)),((682,3415),(1367,2730)))))))))),((((((((((3,4094),(2046,2051)),((1022,3075),(1027,3070))),(((510,3587),(1539,2558)),((515,3582),(1534,2563)))),((((254,3843),(1795,2302)),((771,3326),(1278,2819))),(((259,3838),(1790,2307)),((766,3331),(1283,2814))))),(((((126,3971),(1923,2174)),((899,3198),(1150,2947))),(((387,3710),(1662,2435)),((638,3459),(1411,2686)))),((((131,3966),(1918,2179)),((894,3203),(1155,2942))),(((382,3715),(1667,2430)),((643,3454),(1406,2691)))))),((((((62,4035),(1987,2110)),((963,3134),(1086,3011))),(((451,3646),(1598,2499)),((574,3523),(1475,2622)))),((((195,3902),(1854,2243)),((830,3267),(1219,2878))),(((318,3779),(1731,2366)),((707,3390),(1342,2755))))),(((((67,4030),(1982,2115)),((958,3139),(1091,3006))),(((446,3651),(1603,2494)),((579,3518),(1470,2627)))),((((190,3907),(1859,2238)),((835,3262),(1214,2883))),(((323,3774),(1726,2371)),((702,3395),(1347,2750))))))),(((((((30,4067),(2019,2078)),((995,3102),(1054,3043))),(((483,3614),(1566,2531)),((542,3555),(1507,2590)))),((((227,3870),(1822,2275)),((798,3299),(1251,2846))),(((286,3811),(1763,2334)),((739,3358),(1310,2787))))),(((((99,3998),(1950,2147)),((926,3171),(1123,2974))),(((414,3683),(1635,2462)),((611,3486),(1438,2659)))),((((158,3939),(1891,2206)),((867,3230),(1182,2915))),(((355,3742),(1694,2403)),((670,3427),(1379,2718)))))),((((((35,4062),(2014,2083)),((990,3107),(1059,3038))),(((478,3619),(1571,2526)),((547,3550),(1502,2595)))),((((222,3875),(1827,2270)),((803,3294),(1246,2851))),(((291,3806),(1758,2339)),((734,3363),(1315,2782))))),(((((94,4003),(1955,2142)),((931,3166),(1118,2979))),(((419,3678),(1630,2467)),((606,3491),(1443,2654)))),((((163,3934),(1886,2211)),((862,3235),(1187,2910))),(((350,3747),(1699,2398)),((675,3422),(1374,2723)))))))),((((((((14,4083),(2035,2062)),((1011,3086),(1038,3059))),(((499,3598),(1550,2547)),((526,3571),(1523,2574)))),((((243,3854),(1806,2291)),((782,3315),(1267,2830))),(((270,3827),(1779,2318)),((755,3342),(1294,2803))))),(((((115,3982),(1934,2163)),((910,3187),(1139,2958))),(((398,3699),(1651,2446)),((627,3470),(1422,2675)))),((((142,3955),(1907,2190)),((883,3214),(1166,2931))),(((371,3726),(1678,2419)),((654,3443),(1395,2702)))))),((((((51,4046),(1998,2099)),((974,3123),(1075,3022))),(((462,3635),(1587,2510)),((563,3534),(1486,2611)))),((((206,3891),(1843,2254)),((819,3278),(1230,2867))),(((307,3790),(1742,2355)),((718,3379),(1331,2766))))),(((((78,4019),(1971,2126)),((947,3150),(1102,2995))),(((435,3662),(1614,2483)),((590,3507),(1459,2638)))),((((179,3918),(1870,2227)),((846,3251),(1203,2894))),(((334,3763),(1715,2382)),((691,3406),(1358,2739))))))),(((((((19,4078),(2030,2067)),((1006,3091),(1043,3054))),(((494,3603),(1555,2542)),((531,3566),(1518,2579)))),((((238,3859),(1811,2286)),((787,3310),(1262,2835))),(((275,3822),(1774,2323)),((750,3347),(1299,2798))))),(((((110,3987),(1939,2158)),((915,3182),(1134,2963))),(((403,3694),(1646,2451)),((622,3475),(1427,2670)))),((((147,3950),(1902,2195)),((878,3219),(1171,2926))),(((366,3731),(1683,2414)),((659,3438),(1390,2707)))))),((((((46,4051),(2003,2094)),((979,3118),(1070,3027))),(((467,3630),(1582,2515)),((558,3539),(1491,2606)))),((((211,3886),(1838,2259)),((814,3283),(1235,2862))),(((302,3795),(1747,2350)),((723,3374),(1326,2771))))),(((((83,4014),(1966,2131)),((942,3155),(1107,2990))),(((430,3667),(1619,2478)),((595,3502),(1454,2643)))),((((174,3923),(1875,2222)),((851,3246),(1198,2899))),(((339,3758),(1710,2387)),((686,3411),(1363,2734))))))))),(((((((((6,4091),(2043,2054)),((1019,3078),(1030,3067))),(((507,3590),(1542,2555)),((518,3579),(1531,2566)))),((((251,3846),(1798,2299)),((774,3323),(1275,2822))),(((262,3835),(1787,2310)),((763,3334),(1286,2811))))),(((((123,3974),(1926,2171)),((902,3195),(1147,2950))),(((390,3707),(1659,2438)),((635,3462),(1414,2683)))),((((134,3963),(1915,2182)),((891,3206),(1158,2939))),(((379,3718),(1670,2427)),((646,3451),(1403,2694)))))),((((((59,4038),(1990,2107)),((966,3131),(1083,3014))),(((454,3643),(1595,2502)),((571,3526),(1478,2619)))),((((198,3899),(1851,2246)),((827,3270),(1222,2875))),(((315,3782),(1734,2363)),((710,3387),(1339,2758))))),(((((70,4027),(1979,2118)),((955,3142),(1094,3003))),(((443,3654),(1606,2491)),((582,3515),(1467,2630)))),((((187,3910),(1862,2235)),((838,3259),(1211,2886))),(((326,3771),(1723,2374)),((699,3398),(1350,2747))))))),(((((((27,4070),(2022,2075)),((998,3099),(1051,3046))),(((486,3611),(1563,2534)),((539,3558),(1510,2587)))),((((230,3867),(1819,2278)),((795,3302),(1254,2843))),(((283,3814),(1766,2331)),((742,3355),(1307,2790))))),(((((102,3995),(1947,2150)),((923,3174),(1126,2971))),(((411,3686),(1638,2459)),((614,3483),(1435,2662)))),((((155,3942),(1894,2203)),((870,3227),(1179,2918))),(((358,3739),(1691,2406)),((667,3430),(1382,2715)))))),((((((38,4059),(2011,2086)),((987,3110),(1062,3035))),(((475,3622),(1574,2523)),((550,3547),(1499,2598)))),((((219,3878),(1830,2267)),((806,3291),(1243,2854))),(((294,3803),(1755,2342)),((731,3366),(1318,2779))))),(((((91,4006),(1958,2139)),((934,3163),(1115,2982))),(((422,3675),(1627,2470)),((603,3494),(1446,2651)))),((((166,3931),(1883,2214)),((859,3238),(1190,2907))),(((347,3750),(1702,2395)),((678,3419),(1371,2726)))))))),((((((((11,4086),(2038,2059)),((1014,3083),(1035,3062))),(((502,3595),(1547,2550)),((523,3574),(1526,2571)))),((((246,3851),(1803,2294)),((779,3318),(1270,2827))),(((267,3830),(1782,2315)),((758,3339),(1291,2806))))),(((((118,3979),(1931,2166)),((907,3190),(1142,2955))),(((395,3702),(1654,2443)),((630,3467),(1419,2678)))),((((139,3958),(1910,2187)),((886,3211),(1163,2934))),(((374,3723),(1675,2422)),((651,3446),(1398,2699)))))),((((((54,4043),(1995,2102)),((971,3126),(1078,3019))),(((459,3638),(1590,2507)),((566,3531),(1483,2614)))),((((203,3894),(1846,2251)),((822,3275),(1227,2870))),(((310,3787),(1739,2358)),((715,3382),(1334,2763))))),(((((75,4022),(1974,2123)),((950,3147),(1099,2998))),(((438,3659),(1611,2486)),((587,3510),(1462,2635)))),((((182,3915),(1867,2230)),((843,3254),(1206,2891))),(((331,3766),(1718,2379)),((694,3403),(1355,2742))))))),(((((((22,4075),(2027,2070)),((1003,3094),(1046,3051))),(((491,3606),(1558,2539)),((534,3563),(1515,2582)))),((((235,3862),(1814,2283)),((790,3307),(1259,2838))),(((278,3819),(1771,2326)),((747,3350),(1302,2795))))),(((((107,3990),(1942,2155)),((918,3179),(1131,2966))),(((406,3691),(1643,2454)),((619,3478),(1430,2667)))),((((150,3947),(1899,2198)),((875,3222),(1174,2923))),(((363,3734),(1686,2411)),((662,3435),(1387,2710)))))),((((((43,4054),(2006,2091)),((982,3115),(1067,3030))),(((470,3627),(1579,2518)),((555,3542),(1494,2603)))),((((214,3883),(1835,2262)),((811,3286),(1238,2859))),(((299,3798),(1750,2347)),((726,3371),(1323,2774))))),(((((86,4011),(1963,2134)),((939,3158),(1110,2987))),(((427,3670),(1622,2475)),((598,3499),(1451,2646)))),((((171,3926),(1878,2219)),((854,3243),(1195,2902))),(((342,3755),(1707,2390)),((683,3414),(1366,2731))))))))))))", "((1,4),(2,3))", "(((1,8),(4,5)),((2,7),(3,6)))", "((((1,16),(8,9)),((4,13),(5,12))),(((2,15),(7,10)),((3,14),(6,11))))", "(((((1,32),(16,17)),((8,25),(9,24))),(((4,29),(13,20)),((5,28),(12,21)))),((((2,31),(15,18)),((7,26),(10,23))),(((3,30),(14,19)),((6,27),(11,22)))))"], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "29", "slug": "pacific-atlantic-water-flow", "id": 29, "title": "Pacific Atlantic Water Flow", "difficulty": "Medium", "category": "graph", "link": "https://leetcode.com/problems/pacific-atlantic-water-flow/", "examples": [{"input": "heights = [[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]]", "output": "[[0,4],[1,3],[1,4],[2,2],[3,0],[3,1],[4,0]] (order does not matter)", "explanation": "Cells [[0,4],[1,3],[1,4],[2,2],[3,0],[3,1],[4,0]] can flow to both the Pacific and Atlantic oceans (order does not matter)."}], "hints": ["Run reverse-flow BFS/DFS from both oceans to find cells that can reach each ocean (moving from lower/equal to higher). The answer is the intersection of the two reachable sets."], "statement": "You are given a rectangular grid `heights` with `m` rows and `n` columns, where `heights[r][c]` records the elevation of that square. Rain falling on a square drains into one of the four orthogonal neighbors whenever the neighbor is at the same elevation or lower; by repeating such steps, water can travel across the grid.\n\nSquares along the upper border and the left border drain toward the Pacific Ocean, while squares along the lower border and the right border drain toward the Atlantic Ocean. Collect every position from which descending routes lead to both oceans.\n\n\n\n**Constraints:**\n\n- m == heights.length\n- n == heights[r].length\n- 1 \u2264 m, n \u2264 200\n- 0 \u2264 heights[r][c] \u2264 10^5\n", "solution": "## Approach\n\nPerform DFS from the Pacific (top/left edges) and Atlantic (bottom/right edges) oceans, marking reachable cells by flowing uphill. Cells reachable from both oceans are the answer.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(m * n)\n- **Space Complexity:** O(m * n)\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]:\n m, n = len(heights), len(heights[0])\n pac = [[False] * n for _ in range(m)]\n atl = [[False] * n for _ in range(m)]\n def dfs(i, j, ocean):\n ocean[i][j] = True\n for di, dj in ((1,0),(-1,0),(0,1),(0,-1)):\n ni, nj = i + di, j + dj\n if 0 <= ni < m and 0 <= nj < n and not ocean[ni][nj] and heights[ni][nj] >= heights[i][j]:\n dfs(ni, nj, ocean)\n for i in range(m):\n dfs(i, 0, pac)\n dfs(i, n - 1, atl)\n for j in range(n):\n dfs(0, j, pac)\n dfs(m - 1, j, atl)\n res = []\n for i in range(m):\n for j in range(n):\n if pac[i][j] and atl[i][j]:\n res.append([i, j])\n return res\n```\n", "starter": {"go": "package main\n\nfunc PacificAtlantic(heights [][]int) [][]int {\n \n}", "python": "from typing import List\nclass Solution:\n def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]:\n pass\n", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n vector<vector<int>> pacificAtlantic(vector<vector<int>>& heights) {\n return {};\n }\n};"}, "fn": "pacificAtlantic", "params": [{"name": "heights", "type": "int_array_2d", "visualizeType": "matrix"}], "outputType": "int_array_2d", "tests": [["[[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]]"], ["[[1]]"], ["[[1,2],[4,3]]"], ["[[2,1],[1,2]]"], ["[[0]]"], ["[[100000]]"], ["[[1,2,3]]"], ["[[3,2,1]]"], ["[[1],[2],[3]]"], ["[[3],[2],[1]]"], ["[[5,5],[5,5]]"], ["[[0,0],[0,0]]"], ["[[1,2,3],[4,5,6],[7,8,9]]"], ["[[9,8,7],[6,5,4],[3,2,1]]"], ["[[3,3,3],[3,1,3],[3,3,3]]"], ["[[1,1,1],[1,0,1],[1,1,1]]"], ["[[10,10,10,10],[10,1,1,10],[10,1,1,10],[10,10,10,10]]"], ["[[1,2],[3,4]]"], ["[[4,3],[2,1]]"], ["[[0,1,0],[1,0,1],[0,1,0]]"], ["[[5]]"], ["[[2,2,2],[2,2,2]]"], ["[[7,3,5],[2,8,4]]"], ["[[6,1,4],[3,5,2]]"], ["[[1,3,2],[4,6,5],[7,9,8]]"], ["[[0,5,0,5]]"], ["[[8,7],[6,5],[4,3]]"], ["[[1,10],[10,1]]"], ["[[100,1,100],[1,100,1],[100,1,100]]"], ["[[2,2,1],[2,1,2],[1,2,2]]"]], "expected": [[[0, 4], [1, 3], [1, 4], [2, 2], [3, 0], [3, 1], [4, 0]], [[0, 0]], [[0, 1], [1, 0], [1, 1]], [[0, 0], [0, 1], [1, 0], [1, 1]], [[0, 0]], [[0, 0]], [[0, 0], [0, 1], [0, 2]], [[0, 0], [0, 1], [0, 2]], [[0, 0], [1, 0], [2, 0]], [[0, 0], [1, 0], [2, 0]], [[0, 0], [0, 1], [1, 0], [1, 1]], [[0, 0], [0, 1], [1, 0], [1, 1]], [[0, 2], [1, 2], [2, 0], [2, 1], [2, 2]], [[0, 0], [0, 1], [0, 2], [1, 0], [2, 0]], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1], [2, 2]], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1], [2, 2]], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 3], [2, 0], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]], [[0, 1], [1, 0], [1, 1]], [[0, 0], [0, 1], [1, 0]], [[0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1]], [[0, 0]], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2]], [[0, 0], [0, 2], [1, 0], [1, 1]], [[0, 0], [0, 2], [1, 0], [1, 1]], [[0, 1], [0, 2], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]], [[0, 0], [0, 1], [0, 2], [0, 3]], [[0, 0], [0, 1], [1, 0], [2, 0]], [[0, 1], [1, 0]], [[0, 2], [1, 1], [2, 0]], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1], [2, 2]]], "loose": true}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "375", "slug": "paint-fence", "id": 375, "title": "Paint Fence", "difficulty": "Medium", "category": "dp", "link": "https://leetcode.com/problems/paint-fence/", "examples": [{"input": "n = 3, k = 2", "output": "6", "explanation": "Six colorings of 3 posts with 2 colors avoid three in a row."}, {"input": "n = 1, k = 1", "output": "1", "explanation": "One post has one choice."}, {"input": "n = 2, k = 2", "output": "4", "explanation": "All 2x2 colorings are allowed."}], "hints": ["Track colorings ending with a double (same as previous) versus a fresh color separately.", "A double must follow a fresh color; a fresh color can follow anything with k-1 choices.", "Iterate posts from 3 to n updating both counts."], "statement": "There are `n` fence posts in a row and `k` paint colors. Count the ways to color all posts so no three consecutive posts share one color.\n\nImplement `numWays(n, k)`. Two adjacent posts may share a color, but a run\nof three equal colors is forbidden.\n\n**Constraints:**\n- `1 <= n <= 30`\n- `1 <= k <= 10`\n", "solution": "## Approach\n\nKeep two counts: colorings where the last two posts match (same) and where they differ (diff). Start with same = k and diff = k*(k-1) for two posts, then for each further post the new same equals old diff and the new diff equals (same + diff) * (k-1).\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n)\n- **Space Complexity:** O(1)\n\n## Implementation\n\n```python\nclass Solution:\n def numWays(self, n: int, k: int) -> int:\n if n == 0 or k == 0:\n return 0\n if n == 1:\n return k\n if n == 2:\n return k * k\n if k == 1:\n return 0\n same, diff = k, k * (k - 1)\n for _ in range(3, n + 1):\n same, diff = diff, (same + diff) * (k - 1)\n return same + diff\n```\n", "starter": {"go": "package main\n\nfunc NumWays(n int, k int) int {\n \n}", "python": "class Solution:\n def numWays(self, n: int, k: int) -> int:\n pass", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int numWays(int n, int k) {\n return 0;\n }\n};"}, "fn": "numWays", "params": [{"name": "n", "type": "int"}, {"name": "k", "type": "int"}], "outputType": "int", "tests": [["3", "2"], ["1", "1"], ["2", "2"], ["1", "2"], ["2", "1"], ["3", "1"], ["4", "2"], ["3", "3"], ["4", "3"], ["5", "2"], ["5", "3"], ["1", "5"], ["2", "5"], ["10", "2"], ["15", "2"], ["7", "3"], ["6", "4"], ["5", "5"], ["8", "2"], ["9", "3"], ["3", "4"], ["4", "4"], ["6", "2"], ["6", "3"], ["10", "3"], ["12", "2"], ["20", "2"], ["30", "2"]], "expected": [6, 1, 4, 2, 1, 0, 10, 24, 66, 16, 180, 5, 25, 178, 1974, 1344, 3276, 2800, 68, 10032, 60, 228, 26, 492, 27408, 466, 21892, 2692538], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "367", "slug": "paint-house-ii", "id": 367, "title": "Paint House II", "difficulty": "Hard", "category": "dp", "link": "https://leetcode.com/problems/paint-house-ii/", "examples": [{"input": "costs = [[1,5,3],[2,9,4]]", "output": "5", "explanation": "Paint house 0 with color 0 (1) and house 1 with color 2 (4) for 1 + 4 = 5."}, {"input": "costs = [[1,3],[2,4]]", "output": "5", "explanation": "Either 1 + 4 or 3 + 2 gives 5 while keeping neighbors different."}, {"input": "costs = [[7,6,2]]", "output": "2", "explanation": "With one house, pick the cheapest of its colors."}], "hints": ["For each house, only the smallest and second-smallest totals from the previous house matter.", "A color reuses the smallest previous total unless it used the same color, in which case it falls back to the second smallest."], "statement": "There are `n` houses in a row and `k` colors numbered from `0` to `k - 1`. Painting house `i` with color `j` costs `costs[i][j]`. No two neighboring houses may share the same color.\n\nReturn the smallest total cost to paint every house. When there is one house, the answer is simply its cheapest color.\n\n**Constraints:**\n- `1 <= costs.length <= 100`\n- `1 <= costs[i].length <= 100`\n- `1 <= costs[i][j] <= 1000`\n- Tests use at least two colors whenever there is more than one house.\n", "solution": "## Approach\n\nOnly the best and second-best totals from the previous house are needed. Each color adds its painting cost to the best previous total unless that best used the same color, in which case it uses the second best. Scanning all houses this way keeps the work linear in houses times colors with constant extra state per color count.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n * k), where n is the number of houses and k is the number of colors.\n- **Space Complexity:** O(k) for one row of totals.\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def minCostII(self, costs: List[List[int]]) -> int:\n if not costs:\n return 0\n dp = costs[0][:]\n for row in costs[1:]:\n m1 = m2 = float(\"inf\")\n i1 = -1\n for j, v in enumerate(dp):\n if v < m1:\n m2, m1, i1 = m1, v, j\n elif v < m2:\n m2 = v\n dp = [c + (m2 if j == i1 else m1) for j, c in enumerate(row)]\n return min(dp)\n```\n", "starter": {"go": "package main\n\nfunc MinCostII(costs [][]int) int {\n return 0\n}", "python": "from typing import List\n\nclass Solution:\n def minCostII(self, costs: List[List[int]]) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int minCostII(vector<vector<int>>& costs) {\n return 0;\n }\n};"}, "fn": "minCostII", "params": [{"name": "costs", "type": "int_array_2d"}], "outputType": "int", "tests": [["[[1,5,3],[2,9,4]]"], ["[[1,3],[2,4]]"], ["[[7,6,2]]"], ["[[8,4,4,4],[4,8,8,8],[8,8,4,8]]"], ["[[1,2,3,4]]"], ["[[4,3,2,1]]"], ["[[5,5],[5,5],[5,5]]"], ["[[1,5,3,9],[2,9,4,8],[3,1,7,6]]"], ["[[10,20],[30,10],[20,30]]"], ["[[1,100,100,100],[100,1,100,100],[100,100,1,100]]"], ["[[7,7,7,1],[7,7,1,7],[7,1,7,7],[1,7,7,7]]"], ["[[3,4,10,1],[10,3,4,2],[4,10,3,3]]"], ["[[9,1,9,9],[9,9,1,9],[1,9,9,9]]"], ["[[2,9,10,11],[9,2,9,10],[10,9,2,9]]"], ["[[5]]"], ["[[1,2],[1,2],[1,2],[1,2]]"], ["[[20,19,18,17],[17,18,19,20],[20,17,18,19]]"], ["[[1,2,3],[4,5,6],[7,8,9],[1,1,1]]"], ["[[6,1,6,1],[1,6,1,6],[6,1,6,1]]"], ["[[1000,1],[1,1000],[1000,1],[1,1000]]"], ["[[4,9,3,7,2],[7,2,8,1,9],[3,5,6,4,8]]"], ["[[11,12],[12,11],[11,12],[12,11]]"], ["[[1,2,3,4,5],[5,4,3,2,1],[2,2,2,2,2]]"], ["[[8,15,12],[15,8,12],[12,12,8],[8,8,15]]"], ["[[3,3,3,3,1],[3,3,3,1,3],[3,3,1,3,3]]"], ["[[50,20,30,10],[20,50,30,10],[30,30,20,10]]"]], "expected": [5, 5, 2, 12, 1, 1, 15, 6, 40, 3, 4, 7, 3, 6, 5, 6, 51, 14, 3, 4, 6, 44, 4, 32, 3, 40], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "360", "slug": "paint-house", "id": 360, "title": "Paint House", "difficulty": "Medium", "category": "dp", "link": "https://leetcode.com/problems/paint-house/", "examples": [{"input": "costs = [[17,2,17],[16,16,5],[14,3,19]]", "output": "10", "explanation": "Paint house 0 blue (2), house 1 green (5) and house 2 blue (3) for 2 + 5 + 3 = 10."}, {"input": "costs = [[7,6,2]]", "output": "2", "explanation": "With one house, pick the cheapest color, which costs 2."}, {"input": "costs = [[1,5,3],[2,9,4]]", "output": "5", "explanation": "Paint house 0 red (1) and house 1 green (4) for 1 + 4 = 5."}], "hints": ["Track the cheapest total ending with each color after every house.", "Each new total adds the current painting cost to the better of the two totals that used a different color before."], "statement": "There is a row of houses, and each house can be painted red, blue or green. Painting house `i` costs `costs[i][0]` for red, `costs[i][1]` for blue and `costs[i][2]` for green. No two neighboring houses may share the same color.\n\nReturn the smallest total cost to paint every house.\n\n**Constraints:**\n- `1 <= costs.length <= 100`\n- `costs[i].length == 3`\n- `1 <= costs[i][j] <= 1000`\n", "solution": "## Approach\n\nKeep three running totals for the cheapest cost ending with red, blue, or green after each house. For the next house, each new total adds its painting cost to the smaller of the two totals that used a different color before. After the last house the answer is the smallest of the three totals.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n), where n is the number of houses.\n- **Space Complexity:** O(1) besides the input.\n\n## Implementation\n\n```python\nfrom typing import List\n\nclass Solution:\n def minCost(self, costs: List[List[int]]) -> int:\n r = b = g = 0\n for c in costs:\n r, b, g = c[0] + min(b, g), c[1] + min(r, g), c[2] + min(r, b)\n return min(r, b, g)\n```\n", "starter": {"go": "package main\n\nfunc MinCost(costs [][]int) int {\n return 0\n}", "python": "from typing import List\n\nclass Solution:\n def minCost(self, costs: List[List[int]]) -> int:\n return 0\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n int minCost(vector<vector<int>>& costs) {\n return 0;\n }\n};"}, "fn": "minCost", "params": [{"name": "costs", "type": "int_array_2d"}], "outputType": "int", "tests": [["[[17,2,17],[16,16,5],[14,3,19]]"], ["[[7,6,2]]"], ["[[1,5,3],[2,9,4]]"], ["[[5,8,6],[19,14,13],[7,5,12],[14,15,17],[3,20,10]]"], ["[[1,2,3]]"], ["[[3,2,1]]"], ["[[1,1,1],[1,1,1],[1,1,1]]"], ["[[1000,1,1000],[1,1000,1000],[1000,1000,1]]"], ["[[5,5,5],[5,5,5]]"], ["[[8,4,4],[4,8,8],[8,8,4]]"], ["[[1,100,100],[100,1,100],[100,100,1],[1,100,100]]"], ["[[10,20,30],[30,10,20],[20,30,10]]"], ["[[2,2,1],[1,2,2],[2,1,2]]"], ["[[7,7,7],[7,7,7],[7,7,7],[7,7,7]]"], ["[[1,2,3],[4,5,6],[7,8,9],[10,11,12]]"], ["[[9,1,9],[9,9,1],[1,9,9]]"], ["[[4,9,3],[7,2,8]]"], ["[[6,1,6],[1,6,1],[6,1,6]]"], ["[[3,4,10],[10,3,4],[4,10,3]]"], ["[[1,3,2],[2,1,3],[3,2,1],[1,2,3],[2,3,1]]"], ["[[1000,1000,1],[1000,1,1000],[1,1000,1000]]"], ["[[2,9,10],[9,2,9],[10,9,2]]"], ["[[15,15,1],[15,1,15],[1,15,15],[15,15,1]]"], ["[[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3]]"], ["[[50,20,30],[20,50,30],[30,30,20]]"], ["[[11,12,13],[13,11,12],[12,13,11]]"]], "expected": [10, 2, 5, 43, 1, 1, 3, 3, 10, 12, 4, 30, 3, 28, 24, 3, 5, 3, 9, 5, 3, 6, 4, 7, 60, 33], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "344", "slug": "palindrome-linked-list", "id": 344, "title": "Palindrome Linked List", "difficulty": "Easy", "category": "linked-list", "link": "https://leetcode.com/problems/palindrome-linked-list/", "examples": [{"input": "head = [1,2,2,1]", "output": "true", "explanation": "The values read identically from either end."}, {"input": "head = [1,2]", "output": "false", "explanation": "Reading backward gives [2,1], which differs."}], "hints": ["Copy the values into an array, then check the array with two pointers from both ends.", "For O(1) extra space, find the middle, reverse the second half in place, and compare the halves."], "statement": "Given the head of a singly linked list, decide whether the sequence of values reads the same forward and backward.\n\nA list is a palindrome when reversing it leaves the value order unchanged. An empty list counts as a palindrome, and a single-node list is trivially one.\n\nReturn `true` when the list is a palindrome, otherwise return `false`.\n\n**Constraints:**\n- The number of nodes is in the range `[0, 10^5]`.\n- `0 <= Node.val <= 9`\n", "solution": "## Approach\n\nCollect the node values into an array during one forward pass. Then compare the array from the outside in with two pointers: the first and last values must match, then the second and second-to-last, and so on. Any mismatch means the list is not a palindrome.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n), where n is the number of nodes. Each value is visited a constant number of times.\n- **Space Complexity:** O(n) for the copied values.\n\n## Implementation\n\n```python\nclass Solution:\n def isPalindrome(self, head) -> bool:\n vals = []\n cur = head\n while cur:\n vals.append(cur.val)\n cur = cur.next\n i, j = 0, len(vals) - 1\n while i < j:\n if vals[i] != vals[j]:\n return False\n i += 1\n j -= 1\n return True\n```\n", "starter": {"go": "package main\n\n/*\nDefinition for singly-linked list.\ntype ListNode struct {\n Val int\n Next *ListNode\n}\n*/\n\nfunc IsPalindrome(head *ListNode) bool {\n \n}", "python": "# Definition for singly-linked list.\n# class ListNode:\n# def __init__(self, val=0, next=None):\n# self.val = val\n# self.next = next\n\nclass Solution:\n def isPalindrome(self, head) -> bool:\n pass", "cpp": "/*\nDefinition for singly-linked list.\nstruct ListNode {\n int val;\n ListNode *next;\n ListNode(): val(0), next(nullptr) {}\n ListNode(int x): val(x), next(nullptr) {}\n ListNode(int x, ListNode* next): val(x), next(next) {}\n};\n*/\nclass Solution {\npublic:\n bool isPalindrome(ListNode* head) {\n return false;\n }\n};"}, "fn": "isPalindrome", "params": [{"name": "head", "type": "list_node"}], "outputType": "boolean", "tests": [["[1,2,2,1]"], ["[1,2]"], ["[1]"], ["[]"], ["[1,0,1]"], ["[1,0,0,1]"], ["[1,2,3,2,1]"], ["[1,2,3,4,5]"], ["[0,0,0,0]"], ["[9,8,7,8,9]"], ["[1,2,3,3,2,1]"], ["[1,2,3,4,3,2,1]"], ["[5,5]"], ["[5,4]"], ["[1,2,3,4,5,4,3,2,1]"], ["[0]"], ["[1,1,1,2,1,1,1]"], ["[9,0,9]"], ["[2,2]"], ["[1,2,1]"], ["[3,1,3]"], ["[1,2,3]"], ["[4,4,4]"], ["[1,0,2,0,1]"], ["[9,9,9,9,9]"], ["[1,2,3,4,5,6]"], ["[0,1,0]"], ["[5]"], ["[7,8,9,8,7]"], ["[2,3,4,3,2,9]"]], "expected": [true, false, true, true, true, true, true, false, true, true, true, true, true, false, true, true, true, true, true, true, true, false, true, true, true, false, true, true, true, false], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "253", "slug": "palindrome-number", "id": 253, "title": "Palindrome Number", "difficulty": "Easy", "category": "math", "link": "https://leetcode.com/problems/palindrome-number/", "examples": [{"input": "x = 121", "output": "true", "explanation": "121 is identical when read from either end."}, {"input": "x = -121", "output": "false", "explanation": "The minus sign appears only on one side, so it cannot be a palindrome."}, {"input": "x = 10", "output": "false", "explanation": "Reversed, the digits form 01, which differs from 10."}], "hints": ["Negative numbers are never palindromes; neither are non-zero numbers ending in 0.", "Reverse only half the digits and compare with the remaining half (dropping the middle digit for odd lengths) to avoid overflow."], "statement": "Decide whether a given integer `x` reads the same forwards and backwards in its ordinary decimal writing (without extra leading zeros).\n\nA negative value can never qualify, because the minus sign has no counterpart on the right side. Likewise, a non-zero number ending in `0` cannot qualify, since its reversal would begin with `0`.\n\n**Constraints:**\n- `-2^31 <= x <= 2^31 - 1`\n\n**Follow up:** Try to avoid converting the number to a string. As a hint, reversing only half of the digits keeps every intermediate value safely inside 32 bits.\n", "solution": "## Approach\n\nReject negatives and non-zero multiples of 10 up front, since neither can read the same both ways. Then repeatedly move the last digit of `x` onto a reversed accumulator until the accumulator catches up with what remains. For even-length inputs the halves must match exactly; for odd lengths the middle digit is discarded before comparing.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(log x), proportional to the number of digits.\n- **Space Complexity:** O(1) extra space.\n\n## Implementation\n\n```python\nclass Solution:\n def isPalindrome(self, x: int) -> bool:\n if x < 0 or (x % 10 == 0 and x != 0):\n return False\n rev = 0\n while x > rev:\n rev = rev * 10 + x % 10\n x //= 10\n return x == rev or x == rev // 10\n```\n", "starter": {"go": "package main\n\nfunc IsPalindrome(x int) bool {\n \n}", "python": "class Solution:\n def isPalindrome(self, x: int) -> bool:\n pass", "cpp": "class Solution {\npublic:\n bool isPalindrome(int x) {\n return false;\n }\n};"}, "fn": "isPalindrome", "params": [{"name": "x", "type": "int"}], "outputType": "boolean", "tests": [["121"], ["-121"], ["10"], ["0"], ["1"], ["7"], ["9"], ["11"], ["22"], ["101"], ["111"], ["1221"], ["12321"], ["123321"], ["1001"], ["10001"], ["1000021"], ["100"], ["1000000001"], ["2147447412"], ["2147483647"], ["-2147483648"], ["123456789"], ["987654321"], ["12210"], ["12321"], ["10011"], ["1234321"]], "expected": [true, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, true, true, false, false, false, false, false, true, false, true], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "421", "slug": "palindrome-pairs", "id": 421, "title": "Palindrome Pairs", "difficulty": "Hard", "category": "string", "link": "https://leetcode.com/problems/palindrome-pairs/", "examples": [{"input": "words = [\"abcd\",\"dcba\",\"lls\",\"s\",\"sssll\"]", "output": "[[0,1],[1,0],[3,2],[2,4]]", "explanation": "Reversed partners plus the s/lls/sssll interactions give four pairs."}, {"input": "words = [\"bat\",\"tab\",\"cat\"]", "output": "[[0,1],[1,0]]", "explanation": "Only bat and tab complete each other into palindromes."}, {"input": "words = [\"a\",\"\"]", "output": "[[0,1],[1,0]]", "explanation": "The empty string pairs with any single palindrome word in both directions."}], "hints": ["Index every word so reversed candidates can be looked up instantly.", "Split each word at every cut: when one side is a palindrome, the mirror of the other side is the needed partner.", "Treat the empty string and whole-word mirrors as special cases of the same split rule."], "statement": "You are given a list `words` of pairwise different strings. Find every ordered index pair `(i, j)` with `i != j` such that gluing `words[i]` in front of `words[j]` produces a palindrome (a string reading identically forwards and backwards).\n\nReturn all such pairs. The order of pairs in the answer does not matter.\n\n**Constraints:**\n- `1 <= words.length <= 5000`\n- `0 <= words[i].length <= 300`\n- `words[i]` uses only lowercase English letters.\n- All entries of `words` are distinct.\n\n**Adaptation note:** The nested pair list is represented as `int_list_2d` in this judge; pair order is ignored during checking.\n", "solution": "## Approach\n\nStore each word's position in a map. For every word, try all split points: when the left part reads as a palindrome, the reversed right part (if present as another word) belongs in front; when the right part is a palindrome, the reversed left part belongs behind. Checking both orientations at every cut discovers all completions, including empty-string and full-reversal cases, without pairwise testing.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n * k^2), where n is the word count and k the max length, for split checks and palindrome tests.\n- **Space Complexity:** O(n * k) for the index map and output.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def palindromePairs(self, words: List[str]) -> List[List[int]]:\n pos = {w: i for i, w in enumerate(words)}\n res = []\n seen = set()\n def is_pal(s):\n return s == s[::-1]\n for i, w in enumerate(words):\n n = len(w)\n for cut in range(n + 1):\n left, right = w[:cut], w[cut:]\n if is_pal(left):\n need = right[::-1]\n j = pos.get(need)\n if j is not None and j != i and (j, i) not in seen:\n seen.add((j, i))\n res.append([j, i])\n if right and is_pal(right):\n need = left[::-1]\n j = pos.get(need)\n if j is not None and j != i and (i, j) not in seen:\n seen.add((i, j))\n res.append([i, j])\n return res\n```\n", "starter": {"go": "package main\n\nfunc PalindromePairs(words []string) [][]int {\n return [][]int{}\n}", "python": "from typing import List\nclass Solution:\n def palindromePairs(self, words: List[str]) -> List[List[int]]:\n return []\n", "cpp": "#include <vector>\n#include <string>\nusing namespace std;\nclass Solution {\npublic:\n vector<vector<int>> palindromePairs(vector<string>& words) {\n return {};\n }\n};"}, "fn": "palindromePairs", "params": [{"name": "words", "type": "string_array"}], "outputType": "int_list_2d", "tests": [["['abcd', 'dcba', 'lls', 's', 'sssll']"], ["['bat', 'tab', 'cat']"], ["['a', '']"], ["['a', 'b']"], ["['abc', 'cba']"], ["['a', 'aa', 'aaa']"], ["['race', 'car']"], ["['ab', 'ba', 'abc', 'cba']"], ["['a', 'abc', 'aba', '']"], ["['x', 'y', 'z']"], ["['aa', 'bb', 'ab', 'ba']"], ["['s', 'lls']"], ["['lls', 'sssll']"], ["['a', 'b', 'c', 'ab', 'ac', 'aa']"], ["['abcd', 'dcba']"], ["['', 'a']"], ["['aba', '']"], ["['ab', 'a']"], ["['tac', 'cat', 'act']"], ["['abc', 'def']"], ["['a', 'aa']"], ["['abccaa', 'aaccba']"], ["['racecar', 'car', 'race']"], ["['s', 'sss']"], ["['k', 'kk', 'kkk', 'kitchen']"], ["['abcba', 'xyx', '']"], ["['ababa', 'baba']"], ["['abcd', 'efg']"]], "expected": null, "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "301", "slug": "palindrome-partitioning-ii", "id": 301, "title": "Palindrome Partitioning II", "difficulty": "Hard", "category": "dp", "link": "https://leetcode.com/problems/palindrome-partitioning-ii/", "examples": [{"input": "s = \"aab\"", "output": "1", "explanation": "Splitting as \"aa\" | \"b\" uses one cut and both parts are palindromes."}, {"input": "s = \"a\"", "output": "0", "explanation": "A single character is already a palindrome."}, {"input": "s = \"ab\"", "output": "1", "explanation": "\"a\" | \"b\" is the only palindromic split."}], "hints": ["Expand around every center to mark all palindromic substrings in O(n^2).", "Let dp[i] be the min cuts for the prefix ending at i; extend from each palindrome start.", "A single DP pass with center expansion avoids storing the full n x n table."], "statement": "Given a string `s`, split it into pieces so that every piece reads the same forwards and backwards.\n\nCount cuts between pieces: a string that is already a palindrome needs `0` cuts, a split into two palindromes needs `1` cut, and so on.\n\nReturn the smallest number of cuts that achieves such a split.\n\n**Constraints:**\n- `1 <= s.length <= 2000`\n- `s` contains only lowercase English letters.\n", "solution": "## Approach\n\nExpand around every possible center to discover palindromes while maintaining `cuts[i]`, the cheapest cut count for the prefix ending before index `i`. Whenever a palindrome spans `[l, r]`, the prefix through `r` can be cut after `l - 1` plus one more cut, so relax `cuts[r + 1]` accordingly.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2), where n is the string length. Each center expands outward.\n- **Space Complexity:** O(n) for the cuts array.\n\n## Implementation\n\n```python\nclass Solution:\n def minCut(self, s: str) -> int:\n n = len(s)\n cuts = list(range(-1, n))\n for center in range(n):\n self._expand(s, center, center, cuts)\n self._expand(s, center, center + 1, cuts)\n return cuts[n]\n\n def _expand(self, s, l, r, cuts):\n n = len(s)\n while l >= 0 and r < n and s[l] == s[r]:\n if cuts[l] + 1 < cuts[r + 1]:\n cuts[r + 1] = cuts[l] + 1\n l -= 1\n r += 1\n```\n", "starter": {"go": "package main\n\nfunc MinCut(s string) int {\n \n}", "python": "class Solution:\n def minCut(self, s: str) -> int:\n pass", "cpp": "#include <string>\nusing namespace std;\nclass Solution {\npublic:\n int minCut(string s) {\n return 0;\n }\n};"}, "fn": "minCut", "params": [{"name": "s", "type": "string"}], "outputType": "int", "tests": [["aab"], ["a"], ["ab"], ["aa"], ["aba"], ["abba"], ["abcba"], ["abcde"], ["aaaa"], ["abab"], ["abccba"], ["racecar"], ["banana"], ["civic"], ["noon"], ["abac"], ["aabaa"], ["abcddcba"], ["abcdefedcba"], ["aaabbb"], ["abcbm"], ["kqwertytrewqk"], ["leet"], ["madam"], ["abccaa"], ["cddpd"], ["apjesgpsxoei"], ["abbab"]], "expected": [1, 0, 1, 0, 0, 0, 0, 4, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 2, 0, 2, 0, 3, 2, 11, 1], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "112", "slug": "palindrome-partitioning", "id": 112, "title": "Palindrome Partitioning", "difficulty": "Medium", "category": "backtracking", "link": "https://leetcode.com/problems/palindrome-partitioning/", "examples": [{"input": "s = \"aab\"", "output": "[[\"a\",\"a\",\"b\"],[\"aa\",\"b\"]]", "explanation": "Both `a | a | b` and `aa | b` consist only of palindromes."}, {"input": "s = \"a\"", "output": "[[\"a\"]]", "explanation": "The only way to partition \"a\" such that every substring is a palindrome is [[\"a\"]]."}], "hints": ["Try every possible end position for the next substring.", "Continue backtracking only when the chosen substring is a palindrome."], "statement": "Given a nonempty lowercase string `s`, split it into substrings so that every substring is a palindrome. Return every possible palindrome partition of `s`.\n\nA palindrome reads the same from left to right and right to left. The partitions may be returned in any order, but the substrings within a partition must remain in their original order.\n\n**Constraints:**\n- `1 <= s.length <= 16`\n- `s` contains only lowercase English letters.\n", "solution": "## Approach\n\nPrecompute whether every substring is a palindrome with dynamic programming. Then backtrack from the beginning of the string, choosing only end positions whose substring is marked as a palindrome. Reaching the end means the current choices form one complete partition.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2 + n * P), where `P` is the number of valid partitions; the second term accounts for constructing the output.\n- **Space Complexity:** O(n^2 + n) auxiliary space for the palindrome table and recursion path, excluding the O(n * P) output.\n\n## Implementation\n\n```python\nfrom typing import List\n\n\nclass Solution:\n def partition(self, s: str) -> List[List[str]]:\n n = len(s)\n palindrome = [[False] * n for _ in range(n)]\n for left in range(n - 1, -1, -1):\n for right in range(left, n):\n palindrome[left][right] = (\n s[left] == s[right]\n and (right - left < 2 or palindrome[left + 1][right - 1])\n )\n\n result: List[List[str]] = []\n current: List[str] = []\n\n def backtrack(start: int) -> None:\n if start == n:\n result.append(current.copy())\n return\n for end in range(start, n):\n if not palindrome[start][end]:\n continue\n current.append(s[start : end + 1])\n backtrack(end + 1)\n current.pop()\n\n backtrack(0)\n return result\n```\n", "starter": {"go": "package main\n\nfunc Partition(s string) [][]string {\n return [][]string{}\n}\n", "python": "from typing import List\n\nclass Solution:\n def partition(self, s: str) -> List[List[str]]:\n return []\n", "cpp": "#include <string>\n#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<vector<string>> partition(string s) {\n return {};\n }\n};"}, "fn": "partition", "params": [{"name": "s", "type": "string"}], "outputType": "string_list_2d", "tests": [["a"], ["z"], ["aa"], ["ab"], ["aba"], ["aab"], ["abb"], ["abc"], ["aaa"], ["abba"], ["baab"], ["abac"], ["aaba"], ["abcba"], ["aabaa"], ["aabb"], ["abab"], ["abca"], ["aaaa"], ["abcde"], ["racecar"], ["banana"], ["civic"], ["level"], ["noon"], ["refer"], ["rotor"], ["kayak"], ["madam"], ["redder"], ["deed"], ["peep"], ["toot"], ["stats"], ["tenet"], ["minim"], ["wow"], ["bob"], ["eve"], ["efe"], ["abccba"], ["aabbaa"], ["abcddcba"], ["abacaba"], ["aaaaab"], ["baaaaa"], ["aacaac"], ["abcabc"], ["cabbac"], ["zzxyzz"], ["abcdcba"], ["aabccb"], ["@javascript:'abcdefghijklmnop'"]], "expected": [[["a"]], [["z"]], [["a", "a"], ["aa"]], [["a", "b"]], [["a", "b", "a"], ["aba"]], [["a", "a", "b"], ["aa", "b"]], [["a", "b", "b"], ["a", "bb"]], [["a", "b", "c"]], [["a", "a", "a"], ["a", "aa"], ["aa", "a"], ["aaa"]], [["a", "b", "b", "a"], ["a", "bb", "a"], ["abba"]], [["b", "a", "a", "b"], ["b", "aa", "b"], ["baab"]], [["a", "b", "a", "c"], ["aba", "c"]], [["a", "a", "b", "a"], ["a", "aba"], ["aa", "b", "a"]], [["a", "b", "c", "b", "a"], ["a", "bcb", "a"], ["abcba"]], [["a", "a", "b", "a", "a"], ["a", "a", "b", "aa"], ["a", "aba", "a"], ["aa", "b", "a", "a"], ["aa", "b", "aa"], ["aabaa"]], [["a", "a", "b", "b"], ["a", "a", "bb"], ["aa", "b", "b"], ["aa", "bb"]], [["a", "b", "a", "b"], ["a", "bab"], ["aba", "b"]], [["a", "b", "c", "a"]], [["a", "a", "a", "a"], ["a", "a", "aa"], ["a", "aa", "a"], ["a", "aaa"], ["aa", "a", "a"], ["aa", "aa"], ["aaa", "a"], ["aaaa"]], [["a", "b", "c", "d", "e"]], [["r", "a", "c", "e", "c", "a", "r"], ["r", "a", "cec", "a", "r"], ["r", "aceca", "r"], ["racecar"]], [["b", "a", "n", "a", "n", "a"], ["b", "a", "n", "ana"], ["b", "a", "nan", "a"], ["b", "ana", "n", "a"], ["b", "anana"]], [["c", "i", "v", "i", "c"], ["c", "ivi", "c"], ["civic"]], [["l", "e", "v", "e", "l"], ["l", "eve", "l"], ["level"]], [["n", "o", "o", "n"], ["n", "oo", "n"], ["noon"]], [["r", "e", "f", "e", "r"], ["r", "efe", "r"], ["refer"]], [["r", "o", "t", "o", "r"], ["r", "oto", "r"], ["rotor"]], [["k", "a", "y", "a", "k"], ["k", "aya", "k"], ["kayak"]], [["m", "a", "d", "a", "m"], ["m", "ada", "m"], ["madam"]], [["r", "e", "d", "d", "e", "r"], ["r", "e", "dd", "e", "r"], ["r", "edde", "r"], ["redder"]], [["d", "e", "e", "d"], ["d", "ee", "d"], ["deed"]], [["p", "e", "e", "p"], ["p", "ee", "p"], ["peep"]], [["t", "o", "o", "t"], ["t", "oo", "t"], ["toot"]], [["s", "t", "a", "t", "s"], ["s", "tat", "s"], ["stats"]], [["t", "e", "n", "e", "t"], ["t", "ene", "t"], ["tenet"]], [["m", "i", "n", "i", "m"], ["m", "ini", "m"], ["minim"]], [["w", "o", "w"], ["wow"]], [["b", "o", "b"], ["bob"]], [["e", "v", "e"], ["eve"]], [["e", "f", "e"], ["efe"]], [["a", "b", "c", "c", "b", "a"], ["a", "b", "cc", "b", "a"], ["a", "bccb", "a"], ["abccba"]], [["a", "a", "b", "b", "a", "a"], ["a", "a", "b", "b", "aa"], ["a", "a", "bb", "a", "a"], ["a", "a", "bb", "aa"], ["a", "abba", "a"], ["aa", "b", "b", "a", "a"], ["aa", "b", "b", "aa"], ["aa", "bb", "a", "a"], ["aa", "bb", "aa"], ["aabbaa"]], [["a", "b", "c", "d", "d", "c", "b", "a"], ["a", "b", "c", "dd", "c", "b", "a"], ["a", "b", "cddc", "b", "a"], ["a", "bcddcb", "a"], ["abcddcba"]], [["a", "b", "a", "c", "a", "b", "a"], ["a", "b", "a", "c", "aba"], ["a", "b", "aca", "b", "a"], ["a", "bacab", "a"], ["aba", "c", "a", "b", "a"], ["aba", "c", "aba"], ["abacaba"]], [["a", "a", "a", "a", "a", "b"], ["a", "a", "a", "aa", "b"], ["a", "a", "aa", "a", "b"], ["a", "a", "aaa", "b"], ["a", "aa", "a", "a", "b"], ["a", "aa", "aa", "b"], ["a", "aaa", "a", "b"], ["a", "aaaa", "b"], ["aa", "a", "a", "a", "b"], ["aa", "a", "aa", "b"], ["aa", "aa", "a", "b"], ["aa", "aaa", "b"], ["aaa", "a", "a", "b"], ["aaa", "aa", "b"], ["aaaa", "a", "b"], ["aaaaa", "b"]], [["b", "a", "a", "a", "a", "a"], ["b", "a", "a", "a", "aa"], ["b", "a", "a", "aa", "a"], ["b", "a", "a", "aaa"], ["b", "a", "aa", "a", "a"], ["b", "a", "aa", "aa"], ["b", "a", "aaa", "a"], ["b", "a", "aaaa"], ["b", "aa", "a", "a", "a"], ["b", "aa", "a", "aa"], ["b", "aa", "aa", "a"], ["b", "aa", "aaa"], ["b", "aaa", "a", "a"], ["b", "aaa", "aa"], ["b", "aaaa", "a"], ["b", "aaaaa"]], [["a", "a", "c", "a", "a", "c"], ["a", "a", "c", "aa", "c"], ["a", "a", "caac"], ["a", "aca", "a", "c"], ["aa", "c", "a", "a", "c"], ["aa", "c", "aa", "c"], ["aa", "caac"], ["aacaa", "c"]], [["a", "b", "c", "a", "b", "c"]], [["c", "a", "b", "b", "a", "c"], ["c", "a", "bb", "a", "c"], ["c", "abba", "c"], ["cabbac"]], [["z", "z", "x", "y", "z", "z"], ["z", "z", "x", "y", "zz"], ["zz", "x", "y", "z", "z"], ["zz", "x", "y", "zz"]], [["a", "b", "c", "d", "c", "b", "a"], ["a", "b", "cdc", "b", "a"], ["a", "bcdcb", "a"], ["abcdcba"]], [["a", "a", "b", "c", "c", "b"], ["a", "a", "b", "cc", "b"], ["a", "a", "bccb"], ["aa", "b", "c", "c", "b"], ["aa", "b", "cc", "b"], ["aa", "bccb"]], [["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"]]], "loose": true}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "369", "slug": "palindrome-permutation-ii", "id": 369, "title": "Palindrome Permutation II", "difficulty": "Medium", "category": "backtracking", "link": "https://leetcode.com/problems/palindrome-permutation-ii/", "examples": [{"input": "s = \"aabb\"", "output": "[\"abba\",\"baab\"]", "explanation": "Halves \"ab\" and \"ba\" mirror to full palindromes \"abba\" and \"baab\"."}, {"input": "s = \"abc\"", "output": "[]", "explanation": "Three different characters mean more than one odd count, so no palindrome exists."}, {"input": "s = \"aaa\"", "output": "[\"aaa\"]", "explanation": "All characters match, giving a single distinct palindrome."}], "hints": ["Count characters first; more than one odd count means the answer is empty.", "Build palindromes from half the characters plus the middle character, permuting only the half uniquely."], "statement": "Given a string `s`, return all distinct orderings of its characters that read the same forward and backward. Each result must use every character exactly once. Return the results in any order, or an empty list when no palindromic ordering exists.\n\n**Constraints:**\n- `1 <= s.length <= 16`\n- `s` consists of lowercase English letters.\n", "solution": "## Approach\n\nCount characters; more than one odd count means no palindrome exists. Otherwise split the counts into a middle character and half the pairs. Every distinct permutation of the half mirrors into a full palindrome, generated with duplicate-skipping backtracking so repeated letters produce each result once.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(m * p), where p is the number of distinct palindromes and m is half the string length.\n- **Space Complexity:** O(m) recursion depth plus the output.\n\n## Implementation\n\n```python\nfrom typing import List\nfrom collections import Counter\n\nclass Solution:\n def generatePalindromes(self, s: str) -> List[str]:\n freq = Counter(s)\n mid = \"\"\n half: List[str] = []\n for c in sorted(freq):\n cnt = freq[c]\n if cnt % 2 == 1:\n if mid:\n return []\n mid = c\n half.extend([c] * (cnt // 2))\n res: List[str] = []\n used = [False] * len(half)\n def permute(cur: List[str]) -> None:\n if len(cur) == len(half):\n h = \"\".join(cur)\n res.append(h + mid + h[::-1])\n return\n for i in range(len(half)):\n if used[i]:\n continue\n if i > 0 and half[i] == half[i - 1] and not used[i - 1]:\n continue\n used[i] = True\n cur.append(half[i])\n permute(cur)\n cur.pop()\n used[i] = False\n permute([])\n return res\n```\n", "starter": {"go": "package main\n\nfunc GeneratePalindromes(s string) []string {\n return []string{}\n}", "python": "from typing import List\n\nclass Solution:\n def generatePalindromes(self, s: str) -> List[str]:\n return []\n", "cpp": "#include <string>\n#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<string> generatePalindromes(string s) {\n return {};\n }\n};"}, "fn": "generatePalindromes", "params": [{"name": "s", "type": "string"}], "outputType": "string_list", "tests": [["aabb"], ["abc"], ["aaa"], ["aab"], ["a"], ["aa"], ["ab"], ["aabbcc"], ["aabbc"], ["abcba"], ["aaaa"], ["abcd"], ["aabbccd"], ["racecar"], ["aaabb"], ["abccba"], ["abcdcba"], ["aabcdefaa"], ["zzz"], ["ababa"], ["aabbaa"], ["abcabc"], ["abccaa"], ["aabbccdd"], ["abcdefgh"], ["aaabbbccc"]], "expected": [["abba", "baab"], [], ["aaa"], ["aba"], ["a"], ["aa"], [], ["abccba", "acbbca", "baccab", "bcaacb", "cabbac", "cbaabc"], ["abcba", "bacab"], ["abcba", "bacab"], ["aaaa"], [], ["abcdcba", "acbdbca", "bacdcab", "bcadacb", "cabdbac", "cbadabc"], ["acrerca", "arcecra", "carerac", "craearc", "racecar", "rcaeacr"], ["ababa", "baaab"], ["abccba", "acbbca", "baccab", "bcaacb", "cabbac", "cbaabc"], ["abcdcba", "acbdbca", "bacdcab", "bcadacb", "cabdbac", "cbadabc"], [], ["zzz"], ["ababa", "baaab"], ["aabbaa", "abaaba", "baaaab"], ["abccba", "acbbca", "baccab", "bcaacb", "cabbac", "cbaabc"], [], ["abcddcba", "abdccdba", "acbddbca", "acdbbdca", "adbccbda", "adcbbcda", "bacddcab", "badccdab", "bcaddacb", "bcdaadcb", "bdaccadb", "bdcaacdb", "cabddbac", "cadbbdac", "cbaddabc", "cbdaadbc", "cdabbadc", "cdbaabdc", "dabccbad", "dacbbcad", "dbaccabd", "dbcaacbd", "dcabbacd", "dcbaabcd"], [], []], "loose": true}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "368", "slug": "palindrome-permutation", "id": 368, "title": "Palindrome Permutation", "difficulty": "Easy", "category": "string", "link": "https://leetcode.com/problems/palindrome-permutation/", "examples": [{"input": "s = \"code\"", "output": "false", "explanation": "All four letters differ, so any ordering leaves more than one character with an odd count."}, {"input": "s = \"aab\"", "output": "true", "explanation": "Rearranged as \"aba\", it reads the same in both directions."}, {"input": "s = \"carerac\"", "output": "true", "explanation": "Rearranged as \"racecar\", it is a palindrome."}], "hints": ["A palindrome allows at most one character with an odd count.", "Count characters with a set or map and check how many counts are odd."], "statement": "Given a string `s`, decide whether some rearrangement of its characters can form a palindrome. A palindrome reads the same forward and backward.\n\nReturn `true` when such a rearrangement exists and `false` otherwise.\n\n**Constraints:**\n- `1 <= s.length <= 5000`\n- `s` consists of lowercase and uppercase English letters.\n", "solution": "## Approach\n\nA palindrome mirrors its characters, so at most one character may appear an odd number of times. Toggle each character in a set: adding the first occurrence and removing the second leaves exactly the odd-count characters. The string can be rearranged into a palindrome when at most one entry remains.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n), where n is the length of `s`.\n- **Space Complexity:** O(1) distinct characters besides the input.\n\n## Implementation\n\n```python\nclass Solution:\n def canPermutePalindrome(self, s: str) -> bool:\n odd = set()\n for c in s:\n if c in odd:\n odd.remove(c)\n else:\n odd.add(c)\n return len(odd) <= 1\n```\n", "starter": {"go": "package main\n\nfunc CanPermutePalindrome(s string) bool {\n return false\n}", "python": "class Solution:\n def canPermutePalindrome(self, s: str) -> bool:\n return False\n", "cpp": "#include <string>\nusing namespace std;\n\nclass Solution {\npublic:\n bool canPermutePalindrome(string s) {\n return false;\n }\n};"}, "fn": "canPermutePalindrome", "params": [{"name": "s", "type": "string"}], "outputType": "boolean", "tests": [["code"], ["aab"], ["carerac"], ["a"], ["aa"], ["ab"], ["abc"], ["aabb"], ["aaabbb"], ["abcba"], ["abccba"], ["abcdcba"], ["racecar"], ["hello"], ["Aa"], ["AAaa"], ["aA"], ["tactcoa"], ["xyzzyx"], ["abccccdd"], ["aabbcc"], ["aabbccd"], ["abcdefg"], ["aabbccddeeffg"], ["zzzz"], ["abcabc"]], "expected": [false, true, true, true, true, false, false, true, false, true, true, true, true, false, false, true, false, true, true, false, true, true, false, true, true, true], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "58", "slug": "palindromic-substrings", "id": 58, "title": "Palindromic Substrings", "difficulty": "Medium", "category": "string", "link": "https://leetcode.com/problems/palindromic-substrings/", "examples": [{"input": "s=\"abc\"", "output": "3", "explanation": "The palindromic substrings in \"abc\" are \"a\", \"b\", and \"c\", for a total of 3."}, {"input": "s=\"aaa\"", "output": "6", "explanation": "The palindromic substrings in \"aaa\" are \"a\" (\u00d73), \"aa\" (\u00d72), and \"aaa\" (\u00d71), for a total of 6."}], "hints": ["Expand around centers for each position (odd and even) and count all palindromic substrings."], "statement": "You are given a string `s`. Count the contiguous blocks that read identically forward and backward. Blocks at different starting or ending positions are counted separately even when their text matches.\n\n**Constraints:**\n\n- 1 \u2264 s.length \u2264 1000\n- s consists of lowercase English letters.\n", "solution": "## Approach\n\nExpand around each character (odd-length palindromes) and each gap between characters (even-length palindromes), counting all palindromic substrings found.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n\u00b2)\n- **Space Complexity:** O(1)\n\n## Implementation\n\n```python\nclass Solution:\n def countSubstrings(self, s: str) -> int:\n n = len(s)\n cnt = 0\n for i in range(n):\n for l, r in ((i, i), (i, i + 1)):\n while l >= 0 and r < n and s[l] == s[r]:\n cnt += 1\n l -= 1\n r += 1\n return cnt\n```\n", "starter": {"go": "package main\n\nfunc CountSubstrings(s string) int {\n \n}", "python": "class Solution:\n def countSubstrings(self, s: str) -> int:\n pass\n", "cpp": "#include <string>\nusing namespace std;\nclass Solution {\npublic:\n int countSubstrings(string s) {\n return 0;\n }\n};"}, "fn": "countSubstrings", "params": [{"name": "s", "type": "string"}], "outputType": "int", "tests": [["abc"], ["aaa"], ["abccba"], ["ab"], ["a"], ["ababa"], ["b"], ["z"], ["aa"], ["aba"], ["abba"], ["aaaa"], ["racecar"], ["abcdcba"], ["abacaba"], ["aaaaa"], ["abcba"], ["aabaa"], ["xyzzyx"], ["level"], ["rotor"], ["civic"], ["kayak"], ["madam"], ["abcdef"], ["zzzzzz"], ["abababa"], ["aaabaaa"], ["abccaa"], ["abcddcba"]], "expected": [3, 6, 9, 2, 1, 9, 1, 1, 3, 4, 6, 10, 10, 10, 12, 15, 7, 9, 9, 7, 7, 7, 7, 7, 6, 21, 16, 16, 8, 12], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "955", "slug": "pancake-sorting", "id": 955, "title": "Pancake Sorting", "difficulty": "Medium", "category": "array", "link": "https://leetcode.com/problems/pancake-sorting/", "examples": [{"input": "arr = [3,2,4,1]", "output": "[4,2,4,3]", "explanation": "Flipping 4, then 2, then 4, then 3 sorts the array: [4,2,4,3] is one valid answer (any sorting sequence is accepted)."}, {"input": "arr = [3,2,1]", "output": "[]", "explanation": "A single flip of the whole array reverses it into order, so [3] suffices."}, {"input": "arr = [1,2,3]", "output": "[3]", "explanation": "The array is already sorted, so the empty flip sequence is correct."}], "hints": ["Fix the largest remaining pancake first: bring it to the top, then flip the whole prefix.", "Each size costs at most two flips, comfortably inside the 10n budget.", "The judge replays your flips, so any sorting sequence scores full marks."], "statement": "A pancake flip chooses a positive `k` and reverses the first `k` entries of the array. Starting from `arr` (a permutation of `1..n`), return any sequence of at most `10 * n` flips that leaves the whole array sorted in non-decreasing order. The judge replays your flips, so every valid sorting sequence is accepted \u2014 the reference answer is only one possibility.\n\n**Constraints:**\n- `1 <= arr.length <= 100`\n- `arr` holds each integer from `1` to `arr.length` exactly once.\n- The answer is an integer list with at most `10 * arr.length` entries, each between `1` and `arr.length`.\n", "solution": "## Approach\n\nPlace the pancakes one by one from the largest down. For the unsorted prefix, locate its maximum; if it sits on top, flip the whole prefix to drop it into place, otherwise first flip it to the top and then flip the prefix. Each size needs at most two flips, so the total stays far below the limit and the replay check confirms sortedness.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2) \u2014 finding each maximum scans the remaining prefix.\n- **Space Complexity:** O(n) for the answer plus the working copy.\n\n## Implementation\n\n```python\nclass Solution:\n def pancakeSort(self, arr: list[int]) -> list[int]:\n a = list(arr)\n res = []\n for size in range(len(a), 1, -1):\n mx = max(range(size), key=lambda i: a[i])\n if mx == size - 1:\n continue\n if mx != 0:\n a[:mx + 1] = reversed(a[:mx + 1])\n res.append(mx + 1)\n a[:size] = reversed(a[:size])\n res.append(size)\n return res\n```\n", "starter": {"go": "package main\n\nfunc PancakeSort(arr []int) []int {\n return nil\n}", "python": "from typing import List\nclass Solution:\n def pancakeSort(self, arr: List[int]) -> List[int]:\n return []", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> pancakeSort(vector<int>& arr) {\n return {};\n }\n};"}, "fn": "pancakeSort", "params": [{"name": "arr", "type": "int_array"}], "outputType": "int_list", "tests": [["[3,2,4,1]"], ["[3,2,1]"], ["[1,2,3]"], ["[1]"], ["[2,1]"], ["[4,3,2,1]"], ["[1,3,2]"], ["[2,3,1]"], ["[5,1,4,2,3]"], ["[1,2,3,4,5]"], ["[5,4,3,2,1]"], ["[2,1,4,3]"], ["[3,1,2]"], ["[4,1,3,2]"], ["[6,5,4,3,2,1]"], ["[1,4,2,5,3]"], ["[7,2,5,1,6,3,4]"], ["[2,4,1,5,3]"], ["[10,9,8,7,6,5,4,3,2,1]"], ["[3,5,1,4,2]"], ["[1,5,3,2,4]"], ["[4,5,2,1,3]"], ["[2,3,4,1]"], ["[5,3,4,1,2]"], ["[1,2]"], ["[3,1,4,2,5]"], ["[6,1,2,3,4,5]"], ["[4,6,1,5,2,3]"]], "expected": [[3, 4, 2, 3, 2], [3], [], [], [2], [4], [2, 3, 2], [2, 3], [5, 3, 4, 2, 3, 2], [], [5], [3, 4, 3], [3, 2], [4, 2, 3], [6], [4, 5, 3, 4, 2, 3], [7, 3, 6, 2, 5, 2, 4, 2], [4, 5, 3, 4, 2, 3, 2], [10], [2, 5, 2, 4, 3, 2], [2, 5, 4, 2, 3, 2], [2, 5, 3, 2], [3, 4], [5, 3, 4, 3], [], [3, 4, 2, 3], [6, 5], [2, 6, 3, 5, 4, 2, 3]], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "742", "slug": "parse-lisp-expression", "id": 742, "title": "Parse Lisp Expression", "difficulty": "Hard", "category": "stack", "link": "https://leetcode.com/problems/parse-lisp-expression/", "examples": [{"input": "expression = \"(add 1 2)\"", "output": "3"}, {"input": "expression = \"(mult 3 (add 2 3))\"", "output": "15", "explanation": "Inner (add 2 3) is 5; 3 times 5 is 15."}, {"input": "expression = \"(let x 2 (mult x 5))\"", "output": "10", "explanation": "x binds to 2, then 2 times 5 is 10."}, {"input": "expression = \"(let x 2 y 3 (add x y))\"", "output": "5"}], "hints": ["Parse with an index pointer over the string plus a stack of scopes; each let pushes bindings that are discarded at ')'.", "To evaluate a list, read its head token: add and mult take exactly two sub-expressions, let takes pairs plus a trailing body.", "A bare token is either an integer literal or a variable resolved from the innermost scope outward."], "statement": "You are given a string holding an expression from a tiny Lisp-like language. The language has integers (possibly negative) and three forms, each wrapped in parentheses with space-separated tokens:\n\n- `(add e1 e2)` evaluates both parts and returns their sum.\n- `(mult e1 e2)` evaluates both parts and returns their product.\n- `(let v1 e1 v2 e2 ... expr)` assigns values to variables in order, then evaluates the final `expr`. A variable name holds lowercase letters; later assignments to the same name hide earlier ones, and assignments made inside an inner `let` do not leak outward.\n\nVariable lookup always uses the nearest enclosing assignment. The input expression is guaranteed valid and evaluates to an integer.\n\nImplement `evaluate(expression)`, which takes the expression string and returns its integer value.\n\n**Constraints:**\n- `1 <= expression.length <= 2000`\n- Tokens are `(`, `)`, lowercase variable names, integers (with optional `-`), `add`, `mult`, `let`, separated by single spaces.\n- The expression is well-formed with balanced parentheses.\n", "solution": "## Approach\n\nEvaluate the string with a cursor and a stack of variable scopes. A recursive routine handles one item: a parenthesized list dispatches on its head (`add`, `mult`, or `let`), while a bare token resolves to a literal or the nearest binding. Each `let` pushes a fresh scope, records its pairs in order, evaluates the trailing body, then pops the scope so inner bindings never escape.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n^2) worst case for deeply shadowing lookups over an expression of length n; typically near O(n).\n- **Space Complexity:** O(n) for the scope stack and recursion depth.\n\n## Implementation\n\n```python\nclass Solution:\n def evaluate(self, expression: str) -> int:\n self.s, self.pos = expression, 0\n return self._eval([dict()])\n\n def _skip(self):\n while self.pos < len(self.s) and self.s[self.pos] == ' ':\n self.pos += 1\n\n def _token(self):\n self._skip()\n st = self.pos\n while self.pos < len(self.s) and self.s[self.pos] not in ' ()':\n self.pos += 1\n return self.s[st:self.pos]\n\n def _val(self, tok, scope):\n if tok[0].isdigit() or tok[0] == '-':\n return int(tok)\n for m in reversed(scope):\n if tok in m:\n return m[tok]\n return 0\n\n def _eval(self, scope):\n self._skip()\n if self.s[self.pos] == '(':\n self.pos += 1\n head = self._token()\n if head == 'add':\n a = self._eval(scope)\n b = self._eval(scope)\n res = a + b\n elif head == 'mult':\n a = self._eval(scope)\n b = self._eval(scope)\n res = a * b\n else:\n scope.append(dict())\n while True:\n self._skip()\n if self.s[self.pos] == '(':\n res = self._eval(scope)\n break\n tok = self._token()\n self._skip()\n if self.s[self.pos] == ')':\n res = self._val(tok, scope)\n break\n scope[-1][tok] = self._eval(scope)\n scope.pop()\n self._skip()\n self.pos += 1\n return res\n return self._val(self._token(), scope)\n```\n", "starter": {"go": "package main\n\nfunc Evaluate(expression string) int {\n return 0\n}", "python": "class Solution:\n def evaluate(self, expression: str) -> int:\n return 0\n", "cpp": "#include <string>\nusing namespace std;\nclass Solution {\npublic:\n int evaluate(string expression) {\n return 0;\n }\n};"}, "fn": "evaluate", "params": [{"name": "expression", "type": "string"}], "outputType": "int", "tests": [["(add 1 2)"], ["(mult 3 (add 2 3))"], ["(let x 2 (mult x 5))"], ["(let x 2 y 3 (add x y))"], ["(let x 1 y 2 x 3 (add x y))"], ["(let x 3 x 2 x 1 (add x x))"], ["(add 0 0)"], ["(mult -2 4)"], ["(let a 5 (add a a))"], ["(let x 2 (add (let x 3 (add x x)) x))"], ["(mult 1 1)"], ["(let x -2 (mult x x))"], ["(add (mult 2 3) (mult 4 5))"], ["(let x 7 (let y 8 (add x y)))"], ["(let x 1 (add x (let x 2 (add x x))))"], ["7"], ["-12"], ["(let a 1 b 2 c 3 (add a (add b c)))"], ["(mult (add 1 1) (add 1 1))"], ["(let x 5 (mult x (let x 6 (add x 1))))"], ["(add -1 -2)"], ["(let x 0 (add x 10))"], ["(let ab 3 ba 4 (mult ab ba))"], ["(let x 2 y (add x 3) (mult x y))"], ["(add (let x 1 x) 2)"], ["(mult (let a 2 a) (let b 3 b))"], ["(let x 10 (let x 20 (add x 1)))"], ["(let x 1 y (let x 2 x) (add x y))"]], "expected": [3, 15, 10, 5, 5, 2, 0, -8, 10, 8, 1, 4, 26, 15, 5, 7, -12, 6, 4, 35, -3, 10, 12, 10, 3, 6, 21, 3], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "903", "slug": "partition-array-into-disjoint-intervals", "id": 903, "title": "Partition Array into Disjoint Intervals", "difficulty": "Medium", "category": "array", "link": "https://leetcode.com/problems/partition-array-into-disjoint-intervals/", "examples": [{"input": "nums = [5,0,3,8,6]", "output": "3", "explanation": "Split into [5,0,3] and [8,6]: the left maximum 5 does not exceed the right minimum 6. No shorter left part works."}, {"input": "nums = [1,1,1,0,6,12]", "output": "4", "explanation": "Split into [1,1,1,0] and [6,12]: 1 <= 6 holds, and every shorter left part fails."}, {"input": "nums = [1,2,3,4,5]", "output": "1", "explanation": "The first element alone (1) is already no larger than everything after it."}], "hints": ["For each split position compare the maximum of the left side with the minimum of the right side.", "Precompute prefix maximums left-to-right and suffix minimums right-to-left so every split is checked in O(1).", "Return the first (shortest left side) split whose left maximum does not exceed its right minimum."], "statement": "You are given an integer array `nums`. Cut it into two non-empty contiguous pieces, a left piece and a right piece, such that every value in the left piece is less than or equal to every value in the right piece.\n\nReturn the smallest possible length of the left piece. Every test input admits at least one such cut.\n\n**Constraints:**\n- `2 <= nums.length <= 30000`\n- `0 <= nums[i] <= 10^6`\n", "solution": "## Approach\n\nScan once to build suffix minimums, then sweep from the left tracking the running prefix maximum. The first position where the prefix maximum is at most the suffix minimum starting just after it gives the shortest valid left piece, because any valid cut must satisfy exactly this condition.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n) for the two linear passes.\n- **Space Complexity:** O(n) for the suffix minima (reducible to O(1) with a two-pass variant).\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def partitionDisjoint(self, nums: List[int]) -> int:\n n = len(nums)\n suf = [0] * n\n suf[-1] = nums[-1]\n for i in range(n - 2, -1, -1):\n suf[i] = min(suf[i + 1], nums[i])\n pre = nums[0]\n for i in range(n - 1):\n pre = max(pre, nums[i])\n if pre <= suf[i + 1]:\n return i + 1\n return n\n```\n", "starter": {"go": "package main\n\nfunc PartitionDisjoint(nums []int) int {\n \n}", "python": "from typing import List\nclass Solution:\n def partitionDisjoint(self, nums: List[int]) -> int:\n pass", "cpp": "#include <vector>\nusing namespace std;\nclass Solution {\npublic:\n int partitionDisjoint(vector<int>& nums) {\n return 0;\n }\n};"}, "fn": "partitionDisjoint", "params": [{"name": "nums", "type": "int_array"}], "outputType": "int", "tests": [["[5,0,3,8,6]"], ["[1,1,1,0,6,12]"], ["[1,2,3,4,5]"], ["[5,4,3,2,1,6]"], ["[2, 3, 0, 11, 12, 13]"], ["[1, 1, 1, 3]"], ["[4, 20]"], ["[0, 0, 0, 0, 0, 0, 0, 8, 0, 3, 7, 2]"], ["[1, 0, 4, 8, 6, 4]"], ["[4, 4, 8, 10, 13]"], ["[7, 4, 0, 0, 13, 11, 16]"], ["[5, 1, 1, 2, 8, 13, 8]"], ["[1, 4, 6, 7, 11, 16]"], ["[0, 0, 5]"], ["[0, 6, 6, 17, 17, 16]"], ["[4, 10, 2, 18, 15, 25, 21, 18]"], ["[3, 9]"], ["[7, 13, 14, 12, 9, 9]"], ["[9, 3, 0, 0, 6, 5, 17]"], ["[2, 0, 2, 3, 11, 11, 7, 8]"], ["[2, 1, 0, 1, 2, 5]"], ["[9, 0, 12, 12, 15, 17]"], ["[5, 2, 4, 5, 8, 15, 8, 7, 9, 15]"], ["[4, 3, 14, 8, 10]"], ["[2, 2, 2, 2, 0, 10, 5, 10, 7, 10]"], ["[1, 0, 2, 3, 3, 2, 3, 9, 4]"], ["[3, 2, 10, 10, 19]"], ["[0, 5, 4, 4, 4, 6]"]], "expected": [3, 4, 1, 5, 3, 1, 1, 1, 2, 1, 4, 4, 1, 1, 1, 3, 1, 1, 6, 2, 4, 2, 3, 2, 5, 2, 2, 1], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "128", "slug": "partition-equal-subset-sum", "id": 128, "title": "Partition Equal Subset Sum", "difficulty": "Medium", "category": "dp", "link": "https://leetcode.com/problems/partition-equal-subset-sum/", "examples": [{"input": "nums = [1,5,11,5]", "output": "true", "explanation": "The subsets [1,5,5] and [11] have the same sum."}, {"input": "nums = [1,2,3,5]", "output": "false", "explanation": "The total sum is 11 (odd), so the array cannot be split into two equal-sum subsets."}], "hints": ["An odd total sum can never be split equally.", "Reduce the problem to finding a subset with sum total / 2, and update reachable sums backward."], "statement": "Given an array `nums` of positive integers, return `true` if you can partition the\narray into two subsets whose sums are equal. Every element must belong to exactly one\nof the two subsets.\n\n**Constraints:**\n- `1 <= nums.length <= 200`\n- `1 <= nums[i] <= 100`\n", "solution": "## Approach\n\nAn equal partition is possible only when the total sum is even. Reduce the problem to\nfinding a subset whose sum is half of the total. A one-dimensional boolean array tracks\nreachable sums, and iterating it backward ensures each input value is used at most once.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n * S), where `S` is half of the total sum.\n- **Space Complexity:** O(S).\n\n## Implementation\n\n```python\nfrom typing import List\n\n\nclass Solution:\n def canPartition(self, nums: List[int]) -> bool:\n total = sum(nums)\n if total % 2:\n return False\n\n target = total // 2\n reachable = [False] * (target + 1)\n reachable[0] = True\n for num in nums:\n for value in range(target, num - 1, -1):\n reachable[value] = reachable[value] or reachable[value - num]\n if reachable[target]:\n return True\n return False\n```\n", "starter": {"go": "package main\n\nfunc CanPartition(nums []int) bool {\n return false\n}", "python": "from typing import List\n\nclass Solution:\n def canPartition(self, nums: List[int]) -> bool:\n return False\n", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n bool canPartition(vector<int>& nums) {\n return false;\n }\n};"}, "fn": "canPartition", "params": [{"name": "nums", "type": "int_array"}], "outputType": "boolean", "tests": [["[1,5,11,5]"], ["[1,2,3,5]"], ["[1]"], ["[2]"], ["[1,1]"], ["[1,2]"], ["[2,2]"], ["[2,3,5]"], ["[1,2,3]"], ["[1,1,3]"], ["[3,3,3,4,5]"], ["[2,2,1,1]"], ["[100,100]"], ["[100,99]"], ["[1,1,1,1]"], ["[1,1,1]"], ["[2,4,6,8]"], ["[2,4,8]"], ["[5,5,5,5,5,5]"], ["[7,7,7,7,7]"], ["[1,2,5,10]"], ["[1,2,5,6]"], ["[10,20,30,40]"], ["[10,20,30,41]"], ["[1,3,4,4]"], ["[1,3,4,7]"], ["[8,6,5,4,3,2,1]"], ["[8,7,6,5,4,3,2,1]"], ["[23,13,11,7,5,3,2]"], ["[50,50,49,49,1,1]"], ["[99,1,50,50]"], ["[99,1,49,50]"], ["[14,9,8,4,3,2]"], ["[14,9,8,4,3]"], ["[4,4,4,4,6,6,6,6]"], ["[2,2,2,2,2,2,3]"], ["[2,2,2,2,2,2,4]"], ["[1,6,11,5]"], ["[1,6,11,6]"], ["[20,10,5,5]"], ["[20,10,5,4]"], ["[3,7,12,18,20]"], ["[3,7,12,18,21]"], ["[100,1,2,3,4,90]"], ["[100,1,2,3,4,89]"], ["[1,2,3,4,5,6,7,8,9,10]"], ["[10,10,10,10,10,10,10,10,10,10]"], ["[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]"], ["[2,3,7,8,10]"], ["[2,3,7,8,11]"], ["[31,41,59,26,53,58]"], ["[16,16,16,16,32,32]"], ["[17,16,15,14,13,12,11,10]"], ["[100,100,100,100,99,99,99,99]"], ["[3,3,6,7,8,9,10,12]"], ["[25,25,25,25,25,24,1]"], ["@javascript:JSON.stringify(Array(200).fill(100))"]], "expected": [true, false, false, false, true, false, true, true, true, false, true, true, true, false, true, false, true, false, true, false, false, true, true, false, false, false, false, true, true, true, true, false, true, false, true, false, true, false, true, true, false, true, false, true, false, false, true, true, true, false, false, true, true, true, true, true, true], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "143", "slug": "partition-labels", "id": 143, "title": "Partition Labels", "difficulty": "Medium", "category": "greedy", "link": "https://leetcode.com/problems/partition-labels/", "examples": [{"input": "s = \"ababcbacadefegdehijhklij\"", "output": "[9,7,8]", "explanation": "The maximal split is ababcbaca, defegde, hijhklij."}, {"input": "s = \"eccbbbbdec\"", "output": "[10]", "explanation": "All characters in the string appear within a single contiguous segment, so the partition is [10]."}, {"input": "s = \"abc\"", "output": "[1,1,1]", "explanation": "Each character appears in its own contiguous segment, so the partition is [1,1,1]."}], "hints": ["Record the last index where each letter occurs.", "Scan from left to right while extending the current part's end to the latest final occurrence seen so far.", "When the scan reaches that end, close the part immediately to maximize the total number of parts."], "statement": "You are given a nonempty lowercase string `s`. Split it into as many contiguous parts as possible so that every letter appears in at most one part.\n\nReturn the sizes of the parts from left to right. Concatenating the parts must reproduce the original string.\n\n**Constraints:**\n\n- `1 <= s.length <= 500`\n- `s` contains only lowercase English letters.\n", "solution": "## Approach\n\nRecord the final position of every letter. Scan the string while extending the current partition end to the latest final position of any letter seen in that partition. Once the scan reaches that end, no letter in the partition appears later, so close it immediately to maximize the number of partitions.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n), using two passes over the string.\n- **Space Complexity:** O(1) auxiliary space because the lowercase alphabet has fixed size, excluding the returned list.\n\n## Implementation\n\n```python\nfrom typing import List\n\n\nclass Solution:\n def partitionLabels(self, s: str) -> List[int]:\n last = {character: index for index, character in enumerate(s)}\n sizes = []\n start = 0\n end = 0\n for index, character in enumerate(s):\n end = max(end, last[character])\n if index == end:\n sizes.append(end - start + 1)\n start = index + 1\n return sizes\n```\n", "starter": {"go": "package main\n\nfunc PartitionLabels(s string) []int {\n \n}", "python": "from typing import List\nclass Solution:\n def partitionLabels(self, s: str) -> List[int]:\n pass\n", "cpp": "#include <string>\n#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n vector<int> partitionLabels(string s) {\n return {};\n }\n};"}, "fn": "partitionLabels", "params": [{"name": "s", "type": "string"}], "outputType": "int_array", "tests": [["ababcbacadefegdehijhklij"], ["eccbbbbdec"], ["a"], ["ab"], ["aa"], ["abc"], ["aaaa"], ["abac"], ["abba"], ["abcabc"], ["abcdefghijklmnopqrstuvwxyz"], ["zyxwvutsrqponmlkjihgfedcba"], ["qiejxqfnqceocmy"], ["caedbdedda"], ["abab"], ["abccaddbeffe"], ["abcba"], ["abca"], ["aabbcc"], ["abcddcba"], ["xyzzyx"], ["zzzzy"], ["yzzzz"], ["abcdedcba"], ["aaabbbccc"], ["abcabcdd"], ["abcbadefegde"], ["mnopmnop"], ["leetcode"], ["partitionlabels"], ["cojudge"], ["algorithm"], ["greedy"], ["dynamicprogramming"], ["mississippi"], ["banana"], ["abracadabra"], ["abcdefga"], ["adefaddaccc"], ["vhaagbqkaq"], ["eaaaabaaec"], ["bbveml"], ["ddddd"], ["abcdefgfedcba"], ["aabbacccdde"], ["abcdabc"], ["xxyyzzxy"], ["pqrstp"], ["abcxyzzyxcba"], ["lmnopqrlm"], ["aaabac"], ["zabcaz"], ["cabbac"], ["kkkkkkkkkk"], ["thequickbrownfox"], ["sphinxofblackquartz"], ["@javascript:'abcdefghijklmnopqrstuvwxyz'.repeat(20).slice(0,500)"]], "expected": [[9, 7, 8], [10], [1], [1, 1], [2], [1, 1, 1], [4], [3, 1], [4], [6], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [13, 1, 1], [1, 9], [4], [8, 4], [5], [4], [2, 2, 2], [8], [6], [4, 1], [1, 4], [9], [3, 3, 3], [6, 2], [5, 7], [8], [1, 7], [1, 13, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 2, 1, 1], [1, 1, 16], [1, 10], [1, 5], [11], [8], [8, 3], [1, 1, 8], [9, 1], [2, 1, 1, 1, 1], [5], [13], [5, 3, 2, 1], [7], [8], [6], [12], [9], [5, 1], [6], [6], [10], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1], [500]], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "276", "slug": "partition-list", "id": 276, "title": "Partition List", "difficulty": "Medium", "category": "linked-list", "link": "https://leetcode.com/problems/partition-list/", "examples": [{"input": "head = [1,4,3,2,5,2], x = 3", "output": "[1,2,2,4,3,5]", "explanation": "Values 1, 2, 2 stay in order up front, followed by 4, 3, 5 in order."}, {"input": "head = [2,1], x = 2", "output": "[1,2]", "explanation": "The smaller value 1 moves ahead of 2."}, {"input": "head = [], x = 1", "output": "[]", "explanation": "An empty list stays empty."}], "hints": ["Build two separate chains (before and after) by appending each node to the matching tail.", "Terminate the after-chain with null before joining to avoid cycles.", "Link the before-chain tail to the after-chain head; if before is empty, return after head."], "statement": "Given the head of a linked list and a threshold `x`, reorder the nodes so that all values smaller than `x` appear before all values greater than or equal to `x`. The original relative order inside each of the two groups must be preserved.\n\nOnly the links change; no new values are created. Return the head of the reordered list.\n\n**Constraints:**\n- `0 <= number of nodes <= 200`\n- `-100 <= node value <= 100`\n- `-200 <= x <= 200`\n", "solution": "## Approach\n\nSplit the list into a before-chain and an after-chain with two dummy heads, appending each visited node to whichever tail matches the threshold. Close the after-chain, then splice it after the before-chain so both groups keep their original order.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n), one pass over the list.\n- **Space Complexity:** O(1), only dummy nodes and rewired links.\n\n## Implementation\n\n```python\nclass Solution:\n def partition(self, head, x: int):\n before_head = ListNode(0)\n after_head = ListNode(0)\n before, after = before_head, after_head\n cur = head\n while cur:\n nxt = cur.next\n cur.next = None\n if cur.val < x:\n before.next = cur\n before = before.next\n else:\n after.next = cur\n after = after.next\n cur = nxt\n before.next = after_head.next\n return before_head.next\n```\n", "starter": {"go": "package main\n\n/*\nDefinition for singly-linked list.\ntype ListNode struct {\n Val int\n Next *ListNode\n}\n*/\n\nfunc Partition(head *ListNode, x int) *ListNode {\n \n}", "python": "# class ListNode:\n# def __init__(self, val=0, next=None):\n# self.val = val\n# self.next = next\n\nclass Solution:\n def partition(self, head, x: int):\n pass\n", "cpp": "/*\nstruct ListNode {\n int val;\n ListNode *next;\n ListNode(): val(0), next(nullptr) {}\n ListNode(int x): val(x), next(nullptr) {}\n ListNode(int x, ListNode* next): val(x), next(next) {}\n};\n*/\nclass Solution {\npublic:\n ListNode* partition(ListNode* head, int x) {\n return nullptr;\n }\n};"}, "fn": "partition", "params": [{"name": "head", "type": "list_node"}, {"name": "x", "type": "int"}], "outputType": "list_node", "tests": [["[1,4,3,2,5,2]", "3"], ["[2,1]", "2"], ["[]", "1"], ["[1]", "0"], ["[1]", "2"], ["[1,2,3]", "4"], ["[1,2,3]", "1"], ["[3,2,1]", "2"], ["[1,4,3,0,2,5,2]", "3"], ["[-3,5,8,5,-3,-3]", "0"], ["[5,4,3,2,1]", "3"], ["[1,1,1,1]", "1"], ["[2,2,2,1,1,1]", "2"], ["[0]", "0"], ["[-100,100,0,-50,50]", "0"], ["[4,3,2,1]", "5"], ["[4,3,2,1]", "1"], ["[1,2,3,4,5]", "3"], ["[5,4,3,2,1]", "6"], ["[1,4,2,5,3]", "3"], ["[2,1,3,0,4]", "2"], ["[10,20,30]", "15"], ["[-1,-2,3,2,1,0]", "0"], ["[3,1,2]", "3"], ["[1,2,3,4,5,6,7,8]", "5"], ["[8,7,6,5,4,3,2,1]", "4"], ["[0,0,0,1,1,1]", "1"], ["[5]", "5"], ["[5]", "6"], ["[5]", "4"]], "expected": [[1, 2, 2, 4, 3, 5], [1, 2], null, [1], [1], [1, 2, 3], [1, 2, 3], [1, 3, 2], [1, 0, 2, 2, 4, 3, 5], [-3, -3, -3, 5, 8, 5], [2, 1, 5, 4, 3], [1, 1, 1, 1], [1, 1, 1, 2, 2, 2], [0], [-100, -50, 100, 0, 50], [4, 3, 2, 1], [4, 3, 2, 1], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 4, 5, 3], [1, 0, 2, 3, 4], [10, 20, 30], [-1, -2, 3, 2, 1, 0], [1, 2, 3], [1, 2, 3, 4, 5, 6, 7, 8], [3, 2, 1, 8, 7, 6, 5, 4], [0, 0, 0, 1, 1, 1], [5], [5], [5]], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "211", "slug": "partition-to-k-equal-sum-subsets", "id": 211, "title": "Partition to K Equal Sum Subsets", "difficulty": "Medium", "category": "dp", "link": "https://leetcode.com/problems/partition-to-k-equal-sum-subsets/", "examples": [{"input": "nums = [4,3,2,3,5,2,1], k = 4", "output": "true", "explanation": "It is possible to divide it into 4 subsets (5), (1, 4), (2,3), (2,3) with equal sums."}, {"input": "nums = [1,2,3,4], k = 3", "output": "false", "explanation": "The sum is 10, which is not divisible by 3, so an equal split is impossible."}], "hints": ["Each subset must sum to total / k, so the total sum must be divisible by k.", "We can figure out what target each subset must sum to. Then, let's recursively search, where at each call to our function, we choose which of k subsets the next value will join.", "Use memoization on the bitmask of already-used numbers to avoid re-exploring the same partial assignment."], "statement": "You are given an integer array `nums` and an integer `k`. Decide whether the entries can be split into `k` groups, each containing at least one element, so that every group adds up to the same total. Return `true` when such a split exists and `false` otherwise.\n\n**Constraints:**\n\n- `1 <= k <= nums.length <= 16`\n- `1 <= nums[i] <= 10^4`\n- The frequency of each element is in the range `[1, 4]`.\n", "solution": "## Approach\n\nEvery subset must sum to `target = sum(nums) / k`, so if the total is not divisible by `k` the answer is `false`. The problem is solved with bitmask DP `dp(mask, cur)`: `mask` records which numbers have been assigned, and `cur` is the length of the subset currently being filled (it resets to 0 whenever it reaches `target`). For each unused position `i`, if adding `nums[i]` does not overflow `target`, recurse on the updated mask with the folded current sum. The memo key is just the mask, because the current sum is determined by `sum(mask) % target`. If the full mask is reached, every subset was filled exactly, so return `true`.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(n * 2^n), where n is the length of `nums` \u2014 each mask is visited at most once and scans up to n choices.\n- **Space Complexity:** O(2^n) for the memoization table plus O(n) recursion depth.\n\n## Implementation\n\n```python\nfrom typing import List\n\n\nclass Solution:\n def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:\n total = sum(nums)\n if total % k != 0:\n return False\n target = total // k\n n = len(nums)\n seen = [False] * (1 << n)\n\n def dfs(mask: int, cur: int) -> bool:\n if mask == (1 << n) - 1:\n return True\n if seen[mask]:\n return False\n seen[mask] = True\n for i in range(n):\n if mask & (1 << i):\n continue\n nxt = cur + nums[i]\n if nxt > target:\n continue\n if dfs(mask | (1 << i), 0 if nxt == target else nxt):\n return True\n return False\n\n return dfs(0, 0)\n```", "starter": {"go": "package main\n\nfunc CanPartitionKSubsets(nums []int, k int) bool {\n \n}", "python": "from typing import List\nclass Solution:\n def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:\n ", "cpp": "#include <vector>\nusing namespace std;\n\nclass Solution {\npublic:\n bool canPartitionKSubsets(vector<int>& nums, int k) {\n \n }\n};"}, "fn": "canPartitionKSubsets", "params": [{"name": "nums", "type": "int_array"}, {"name": "k", "type": "int"}], "outputType": "boolean", "tests": [["[1]", "1"], ["[4,3,2,3,5,2,1]", "4"], ["[1,2,3,4]", "3"], ["[1,1,1,1,2,2,2,2,3,3,3,3]", "6"], ["[1,2,3,4,5]", "2"], ["[4,4,4,4,5,5,5,5]", "4"], ["[3,3,3,3]", "4"], ["[1,2,2,3]", "2"], ["[1,1,1]", "2"], ["[2,2,2,2,3,3,3,3]", "4"], ["[1,2,3,6,5,4]", "3"], ["[4,3,2,3,5,2,1]", "5"], ["[2,2,2]", "3"], ["[1,1,2,2]", "2"], ["[5,5,5,5]", "2"], ["[1,2,3]", "3"], ["[2,4,6]", "2"], ["[3,3,3,6]", "2"], ["[1,1,1,1]", "2"], ["[2,2,3,3,4,4]", "3"], ["[10,10,10,10]", "2"], ["[1,5,5,1,5,1]", "3"], ["[7,3,7,3,7,3,7,3]", "4"], ["[100,200,300,400]", "2"], ["[1,2,3,4,5,6]", "2"], ["[8,8,8,8]", "4"], ["[6,6,6,12]", "2"], ["[2,3,5,7,7,3,2,5]", "4"], ["[9,9,9,1,1,1]", "3"], ["[4,4,8,8,12,12]", "3"]], "expected": [true, true, false, true, false, true, true, true, false, true, true, false, true, true, true, false, true, false, true, true, true, true, true, true, false, true, false, false, true, true], "loose": false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"basic": false, "label": "296", "slug": "pascals-triangle-ii", "id": 296, "title": "Pascal's Triangle II", "difficulty": "Easy", "category": "dp", "link": "https://leetcode.com/problems/pascals-triangle-ii/", "examples": [{"input": "rowIndex = 3", "output": "[1,3,3,1]", "explanation": "The fourth (0-based third) row is [1,3,3,1]."}, {"input": "rowIndex = 0", "output": "[1]", "explanation": "Row 0 holds just the apex."}, {"input": "rowIndex = 1", "output": "[1,1]", "explanation": "Row 1 holds two ones."}], "hints": ["Build only one row in place by updating it from right to left so needed values are not overwritten.", "Row edges stay 1; each interior entry is the sum of the two values above it.", "Adaptation: the value list maps to int_array in this judge."], "statement": "Return a single 0-based row of Pascal's triangle.\n\nRow 0 is `[1]`, row 1 is `[1,1]`, and each later row starts and ends with `1` while interior entries sum the two numbers above them. Given `rowIndex`, produce exactly that row without necessarily building the whole triangle.\n\n**Constraints:**\n- `0 <= rowIndex <= 33`\n\n**Adaptation note:** The value list is represented as `int_array` in this judge.\n", "solution": "## Approach\n\nKeep a single array that evolves row by row. Start with a row of ones of the target length; for each row from 2 onward update interior entries from right to left so each new entry sums the two values that sat above it. Right-to-left order preserves the previous row's values until they are consumed.\n\n## Complexity Analysis\n\n- **Time Complexity:** O(rowIndex^2), one update per entry of each intermediate row.\n- **Space Complexity:** O(rowIndex) for the rolling row.\n\n## Implementation\n\n```python\nfrom typing import List\nclass Solution:\n def getRow(self, rowIndex: int) -> List[int]:\n row = [1] * (rowIndex + 1)\n for r in range(2, rowIndex + 1):\n for c in range(r - 1, 0, -1):\n row[c] = row[c] + row[c - 1]\n return row\n```\n", "starter": {"go": "package main\n\nfunc GetRow(rowIndex int) []int {\n \n}", "python": "from typing import List\nclass Solution:\n def getRow(self, rowIndex: int) -> List[int]:\n pass\n", "cpp": "class Solution {\npublic:\n vector<int> getRow(int rowIndex) {\n \n }\n};"}, "fn": "getRow", "params": [{"name": "rowIndex", "type": "int"}], "outputType": "int_array", "tests": [["0"], ["1"], ["2"], ["3"], ["4"], ["5"], ["6"], ["7"], ["8"], ["9"], ["10"], ["11"], ["12"], ["13"], ["14"], ["15"], ["16"], ["17"], ["18"], ["19"], ["20"], ["21"], ["22"], ["23"], ["24"], ["25"], ["26"], ["27"], ["28"], ["29"], ["30"], ["31"], ["32"], ["33"]], "expected": [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1], [1, 6, 15, 20, 15, 6, 1], [1, 7, 21, 35, 35, 21, 7, 1], [1, 8, 28, 56, 70, 56, 28, 8, 1], [1, 9, 36, 84, 126, 126, 84, 36, 9, 1], [1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1], [1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1], [1, 12, 66, 220, 495, 792, 924, 792, 495, 220, 66, 12, 1], [1, 13, 78, 286, 715, 1287, 1716, 1716, 1287, 715, 286, 78, 13, 1], [1, 14, 91, 364, 1001, 2002, 3003, 3432, 3003, 2002, 1001, 364, 91, 14, 1], [1, 15, 105, 455, 1365, 3003, 5005, 6435, 6435, 5005, 3003, 1365, 455, 105, 15, 1], [1, 16, 120, 560, 1820, 4368, 8008, 11440, 12870, 11440, 8008, 4368, 1820, 560, 120, 16, 1], [1, 17, 136, 680, 2380, 6188, 12376, 19448, 24310, 24310, 19448, 12376, 6188, 2380, 680, 136, 17, 1], [1, 18, 153, 816, 3060, 8568, 18564, 31824, 43758, 48620, 43758, 31824, 18564, 8568, 3060, 816, 153, 18, 1], [1, 19, 171, 969, 3876, 11628, 27132, 50388, 75582, 92378, 92378, 75582, 50388, 27132, 11628, 3876, 969, 171, 19, 1], [1, 20, 190, 1140, 4845, 15504, 38760, 77520, 125970, 167960, 184756, 167960, 125970, 77520, 38760, 15504, 4845, 1140, 190, 20, 1], [1, 21, 210, 1330, 5985, 20349, 54264, 116280, 203490, 293930, 352716, 352716, 293930, 203490, 116280, 54264, 20349, 5985, 1330, 210, 21, 1], [1, 22, 231, 1540, 7315, 26334, 74613, 170544, 319770, 497420, 646646, 705432, 646646, 497420, 319770, 170544, 74613, 26334, 7315, 1540, 231, 22, 1], [1, 23, 253, 1771, 8855, 33649, 100947, 245157, 490314, 817190, 1144066, 1352078, 1352078, 1144066, 817190, 490314, 245157, 100947, 33649, 8855, 1771, 253, 23, 1], [1, 24, 276, 2024, 10626, 42504, 134596, 346104, 735471, 1307504, 1961256, 2496144, 2704156, 2496144, 1961256, 1307504, 735471, 346104, 134596, 42504, 10626, 2024, 276, 24, 1], [1, 25, 300, 2300, 12650, 53130, 177100, 480700, 1081575, 2042975, 3268760, 4457400, 5200300, 5200300, 4457400, 3268760, 2042975, 1081575, 480700, 177100, 53130, 12650, 2300, 300, 25, 1], [1, 26, 325, 2600, 14950, 65780, 230230, 657800, 1562275, 3124550, 5311735, 7726160, 9657700, 10400600, 9657700, 7726160, 5311735, 3124550, 1562275, 657800, 230230, 65780, 14950, 2600, 325, 26, 1], [1, 27, 351, 2925, 17550, 80730, 296010, 888030, 2220075, 4686825, 8436285, 13037895, 17383860, 20058300, 20058300, 17383860, 13037895, 8436285, 4686825, 2220075, 888030, 296010, 80730, 17550, 2925, 351, 27, 1], [1, 28, 378, 3276, 20475, 98280, 376740, 1184040, 3108105, 6906900, 13123110, 21474180, 30421755, 37442160, 40116600, 37442160, 30421755, 21474180, 13123110, 6906900, 3108105, 1184040, 376740, 98280, 20475, 3276, 378, 28, 1], [1, 29, 406, 3654, 23751, 118755, 475020, 1560780, 4292145, 10015005, 20030010, 34597290, 51895935, 67863915, 77558760, 77558760, 67863915, 51895935, 34597290, 20030010, 10015005, 4292145, 1560780, 475020, 118755, 23751, 3654, 406, 29, 1], [1, 30, 435, 4060, 27405, 142506, 593775, 2035800, 5852925, 14307150, 30045015, 54627300, 86493225, 119759850, 145422675, 155117520, 145422675, 119759850, 86493225, 54627300, 30045015, 14307150, 5852925, 2035800, 593775, 142506, 27405, 4060, 435, 30, 1], [1, 31, 465, 4495, 31465, 169911, 736281, 2629575, 7888725, 20160075, 44352165, 84672315, 141120525, 206253075, 265182525, 300540195, 300540195, 265182525, 206253075, 141120525, 84672315, 44352165, 20160075, 7888725, 2629575, 736281, 169911, 31465, 4495, 465, 31, 1], [1, 32, 496, 4960, 35960, 201376, 906192, 3365856, 10518300, 28048800, 64512240, 129024480, 225792840, 347373600, 471435600, 565722720, 601080390, 565722720, 471435600, 347373600, 225792840, 129024480, 64512240, 28048800, 10518300, 3365856, 906192, 201376, 35960, 4960, 496, 32, 1], [1, 33, 528, 5456, 40920, 237336, 1107568, 4272048, 13884156, 38567100, 92561040, 193536720, 354817320, 573166440, 818809200, 1037158320, 1166803110, 1166803110, 1037158320, 818809200, 573166440, 354817320, 193536720, 92561040, 38567100, 13884156, 4272048, 1107568, 237336, 40920, 5456, 528, 33, 1]], "loose": false}
|