RyanIRL's picture
Add the Python execution prediction training pool
199869f verified
Raw
History Blame Contribute Delete
482 kB
{"submissionId": "cmskf3c8200001wp2osjhk0zm", "title": "Submission JHK0ZM", "payload": {"code": "def collect(item, bucket=[]):\n bucket.append(item)\n return bucket\n\ndef demo():\n first = collect(\"a\")\n second = collect(\"b\")\n return (first, second, first is second)", "input": "demo()", "language": "Python", "predicted_output": "(['a', 'b'], ['a', 'b'], True)"}}
{"submissionId": "cmskf3c8200011wp22kb81bve", "title": "Submission B81BVE", "payload": {"code": "records = [\n {\"name\": \"ida\", \"dept\": \"ops\", \"years\": 4},\n {\"name\": \"ben\", \"dept\": \"eng\", \"years\": 4},\n {\"name\": \"cy\", \"dept\": \"eng\", \"years\": 7},\n]\n\ndef rank():\n ordered = sorted(records, key=lambda r: (r[\"dept\"], -r[\"years\"], r[\"name\"]))\n return [(r[\"dept\"], r[\"name\"], r[\"years\"]) for r in ordered]", "input": "rank()", "language": "Python", "predicted_output": "[('eng', 'cy', 7), ('eng', 'ben', 4), ('ops', 'ida', 4)]"}}
{"submissionId": "cmskf3c8200021wp23qmbd6xs", "title": "Submission MBD6XS", "payload": {"code": "from collections import Counter\n\ndef tally():\n counts = Counter(\"pear fig pear plum fig date\".split())\n return (counts.most_common(2), counts[\"kiwi\"], len(counts))", "input": "tally()", "language": "Python", "predicted_output": "([('pear', 2), ('fig', 2)], 0, 4)"}}
{"submissionId": "cmskf3c8200031wp2jpynnp7y", "title": "Submission YNNP7Y", "payload": {"code": "def resolve(flag):\n try:\n if flag:\n return \"from-try\"\n raise ValueError(\"bad flag\")\n except ValueError:\n return \"from-except\"\n finally:\n print(\"cleanup ran\")\n\ndef demo():\n return (resolve(True), resolve(False))", "input": "demo()", "language": "Python", "predicted_output": "cleanup ran\ncleanup ran\n('from-try', 'from-except')"}}
{"submissionId": "cmskf3c8200041wp2vszakqde", "title": "Submission ZAKQDE", "payload": {"code": "import copy\n\ndef demo():\n grid = [[0, 1], [2, 3]]\n shallow = list(grid)\n deep = copy.deepcopy(grid)\n grid[0][0] = 99\n return (shallow[0][0], deep[0][0], shallow[0] is grid[0])", "input": "demo()", "language": "Python", "predicted_output": "(99, 0, True)"}}
{"submissionId": "cmskf3c8200051wp25947eul8", "title": "Submission 47EUL8", "payload": {"code": "def demo():\n loose = []\n for factor in range(1, 4):\n loose.append(lambda x: x * factor)\n bound = [lambda x, factor=factor: x * factor for factor in range(1, 4)]\n return ([f(10) for f in loose], [f(10) for f in bound])", "input": "demo()", "language": "Python", "predicted_output": "([30, 30, 30], [10, 20, 30])"}}
{"submissionId": "cmskf3c8200061wp24z0nxfpf", "title": "Submission 0NXFPF", "payload": {"code": "from itertools import groupby\n\ntickets = [\"ops-3\", \"eng-1\", \"ops-9\", \"eng-4\"]\n\ndef team_of(ticket):\n return ticket.split(\"-\")[0]\n\ndef demo():\n raw = [(team, list(g)) for team, g in groupby(tickets, key=team_of)]\n tidy = [(team, list(g)) for team, g in groupby(sorted(tickets), key=team_of)]\n return (raw, tidy)", "input": "demo()", "language": "Python", "predicted_output": "([('ops', ['ops-3']), ('eng', ['eng-1']), ('ops', ['ops-9']), ('eng', ['eng-4'])], [('eng', ['eng-1', 'eng-4']), ('ops', ['ops-3', 'ops-9'])])"}}
{"submissionId": "cmskf3c8200071wp2lcgno27p", "title": "Submission GNO27P", "payload": {"code": "def demo():\n config = {\"retries\": 3}\n kept = config.setdefault(\"retries\", 10)\n added = config.setdefault(\"timeout\", 30)\n return (kept, added, config.get(\"timeout\", 99), sorted(config.items()))", "input": "demo()", "language": "Python", "predicted_output": "(3, 30, 30, [('retries', 3), ('timeout', 30)])"}}
{"submissionId": "cmskf3c8200081wp28tpa14hx", "title": "Submission PA14HX", "payload": {"code": "class ParseError(Exception):\n pass\n\ndef parse_port(raw):\n try:\n return int(raw)\n except ValueError:\n raise ParseError(\"not a port: \" + raw) from None\n\ndef demo():\n results = []\n for raw in [\"8080\", \"https\"]:\n try:\n results.append(parse_port(raw))\n except ParseError as exc:\n results.append(type(exc).__name__ + \": \" + str(exc))\n return results", "input": "demo()", "language": "Python", "predicted_output": "[8080, 'ParseError: not a port: https']"}}
{"submissionId": "cmskf3c8300091wp29wn8ecs7", "title": "Submission N8ECS7", "payload": {"code": "def demo():\n path = \"a/b/c/d\"\n parts = path.split(\"/\")\n return (parts[::-1], \"/\".join(parts[1:-1]), path.partition(\"/\"), path[::2])", "input": "demo()", "language": "Python", "predicted_output": "(['d', 'c', 'b', 'a'], 'b/c', ('a', '/', 'b/c/d'), 'abcd')"}}
{"submissionId": "cmskfpd460000x6p2765o8s86", "title": "Submission 5O8S86", "payload": {"code": "from collections import defaultdict\n\ndef index_by_initial(names):\n buckets = defaultdict(list)\n for name in names:\n buckets[name[0]].append(name)\n missing = buckets[\"z\"]\n return (dict(buckets), missing, \"z\" in buckets)", "input": "index_by_initial([\"ana\", \"arjun\", \"bela\", \"cy\"])", "language": "Python", "predicted_output": "({'a': ['ana', 'arjun'], 'b': ['bela'], 'c': ['cy'], 'z': []}, [], True)"}}
{"submissionId": "cmskfpd470001x6p23240prqe", "title": "Submission 40PRQE", "payload": {"code": "from collections import deque\n\ndef shuffle_queue():\n q = deque([1, 2, 3, 4], maxlen=4)\n q.rotate(1)\n snapshot = list(q)\n q.appendleft(99)\n return (snapshot, list(q), q.maxlen)", "input": "shuffle_queue()", "language": "Python", "predicted_output": "([4, 1, 2, 3], [99, 4, 1, 2], 4)"}}
{"submissionId": "cmskfpd470002x6p2ycc8i1sj", "title": "Submission C8I1SJ", "payload": {"code": "from collections import namedtuple\n\nPoint = namedtuple(\"Point\", [\"x\", \"y\"])\n\ndef move_point():\n origin = Point(0, 0)\n shifted = origin._replace(y=5)\n return (origin, shifted, origin == Point(0, 0), shifted._asdict())", "input": "move_point()", "language": "Python", "predicted_output": "(Point(x=0, y=0), Point(x=0, y=5), True, {'x': 0, 'y': 5})"}}
{"submissionId": "cmskfpd470003x6p208eutk8e", "title": "Submission EUTK8E", "payload": {"code": "from collections import OrderedDict\n\ndef reorder():\n od = OrderedDict([(\"a\", 1), (\"b\", 2), (\"c\", 3)])\n od.move_to_end(\"a\")\n first = list(od.keys())\n od.move_to_end(\"c\", last=False)\n return (first, list(od.keys()))", "input": "reorder()", "language": "Python", "predicted_output": "(['b', 'c', 'a'], ['c', 'b', 'a'])"}}
{"submissionId": "cmskfpd470004x6p2uwirhw78", "title": "Submission IRHW78", "payload": {"code": "from collections import Counter\n\ndef counter_math():\n left = Counter(a=3, b=1)\n right = Counter(a=1, b=4)\n return (dict(left - right), dict(left + right), dict(left & right))", "input": "counter_math()", "language": "Python", "predicted_output": "({'a': 2}, {'a': 4, 'b': 5}, {'a': 1, 'b': 1})"}}
{"submissionId": "cmskfpd470005x6p2foxxbcs1", "title": "Submission XXBCS1", "payload": {"code": "from functools import lru_cache\n\ncalls = []\n\n@lru_cache(maxsize=None)\ndef slow_square(n):\n calls.append(n)\n return n * n\n\ndef demo_cache():\n results = [slow_square(4), slow_square(4), slow_square(5)]\n return (results, calls)", "input": "demo_cache()", "language": "Python", "predicted_output": "([16, 16, 25], [4, 5])"}}
{"submissionId": "cmskfpd470006x6p2krj21lmm", "title": "Submission J21LMM", "payload": {"code": "from functools import partial\n\ndef power(base, exponent):\n return base ** exponent\n\ndef demo_partial():\n square = partial(power, exponent=2)\n cube_of_two = partial(power, 2)\n return (square(7), cube_of_two(3))", "input": "demo_partial()", "language": "Python", "predicted_output": "(49, 8)"}}
{"submissionId": "cmskfpd470007x6p222pr0xuz", "title": "Submission PR0XUZ", "payload": {"code": "from functools import reduce\n\ndef fold():\n numbers = [3, 1, 4, 1, 5]\n total = reduce(lambda a, b: a + b, numbers)\n seeded = reduce(lambda a, b: a + b, numbers, 100)\n largest = reduce(lambda a, b: a if a > b else b, numbers)\n return (total, seeded, largest)", "input": "fold()", "language": "Python", "predicted_output": "(14, 114, 5)"}}
{"submissionId": "cmskfpd470008x6p2phg7werx", "title": "Submission G7WERX", "payload": {"code": "from functools import wraps\n\ndef announce(fn):\n @wraps(fn)\n def inner(*args, **kwargs):\n return fn(*args, **kwargs) * 2\n return inner\n\ndef plain(fn):\n def inner(*args, **kwargs):\n return fn(*args, **kwargs)\n return inner\n\n@announce\ndef base(x):\n \"\"\"docstring here\"\"\"\n return x + 1\n\n@plain\ndef other(x):\n return x\n\ndef demo_wraps():\n return (base(4), base.__name__, base.__doc__, other.__name__)", "input": "demo_wraps()", "language": "Python", "predicted_output": "(10, 'base', 'docstring here', 'inner')"}}
{"submissionId": "cmskfpd470009x6p2zmftr2s5", "title": "Submission FTR2S5", "payload": {"code": "class Base:\n def greet(self):\n return \"base\"\n\nclass Left(Base):\n def greet(self):\n return \"left->\" + super().greet()\n\nclass Right(Base):\n def greet(self):\n return \"right->\" + super().greet()\n\nclass Both(Left, Right):\n pass\n\ndef demo_mro():\n return (Both().greet(), [c.__name__ for c in Both.__mro__])", "input": "demo_mro()", "language": "Python", "predicted_output": "('left->right->base', ['Both', 'Left', 'Right', 'Base', 'object'])"}}
{"submissionId": "cmskfpd47000ax6p223kae635", "title": "Submission KAE635", "payload": {"code": "class Temperature:\n def __init__(self, celsius):\n self._celsius = celsius\n\n @property\n def fahrenheit(self):\n return self._celsius * 9 / 5 + 32\n\n @fahrenheit.setter\n def fahrenheit(self, value):\n self._celsius = (value - 32) * 5 / 9\n\ndef demo_property():\n t = Temperature(100)\n before = t.fahrenheit\n t.fahrenheit = 32\n return (before, t._celsius)", "input": "demo_property()", "language": "Python", "predicted_output": "(212.0, 0.0)"}}
{"submissionId": "cmskfpd47000bx6p2bq3uvguo", "title": "Submission 3UVGUO", "payload": {"code": "class Money:\n def __init__(self, amount):\n self.amount = amount\n\n def __add__(self, other):\n return Money(self.amount + other.amount)\n\n def __eq__(self, other):\n return self.amount == other.amount\n\n def __repr__(self):\n return \"Money(\" + str(self.amount) + \")\"\n\ndef demo_operators():\n total = Money(5) + Money(7)\n return (total, total == Money(12), [Money(1), Money(2)])", "input": "demo_operators()", "language": "Python", "predicted_output": "(Money(12), True, [Money(1), Money(2)])"}}
{"submissionId": "cmskfpd47000cx6p2x1o0moev", "title": "Submission O0MOEV", "payload": {"code": "class Registry:\n members = []\n\n def __init__(self, name):\n self.name = name\n Registry.members.append(name)\n\n @classmethod\n def count(cls):\n return len(cls.members)\n\n @staticmethod\n def label():\n return \"registry\"\n\ndef demo_class_state():\n Registry(\"a\")\n Registry(\"b\")\n return (Registry.count(), Registry.label(), Registry.members)", "input": "demo_class_state()", "language": "Python", "predicted_output": "(2, 'registry', ['a', 'b'])"}}
{"submissionId": "cmskfpd47000dx6p2ggiej64m", "title": "Submission IEJ64M", "payload": {"code": "class Counter:\n total = 0\n\n def bump(self):\n self.total += 1\n return self.total\n\ndef demo_shadowing():\n a = Counter()\n b = Counter()\n first = a.bump()\n second = a.bump()\n return (first, second, b.total, Counter.total, \"total\" in a.__dict__)", "input": "demo_shadowing()", "language": "Python", "predicted_output": "(1, 2, 0, 0, True)"}}
{"submissionId": "cmskfpd47000ex6p25pphz9hy", "title": "Submission PHZ9HY", "payload": {"code": "class Resource:\n def __init__(self, log):\n self.log = log\n\n def __enter__(self):\n self.log.append(\"enter\")\n return self\n\n def __exit__(self, exc_type, exc, tb):\n self.log.append(\"exit:\" + (exc_type.__name__ if exc_type else \"clean\"))\n return True\n\ndef demo_context():\n log = []\n with Resource(log):\n log.append(\"body\")\n with Resource(log):\n raise ValueError(\"boom\")\n return log", "input": "demo_context()", "language": "Python", "predicted_output": "['enter', 'body', 'exit:clean', 'enter', 'exit:ValueError']"}}
{"submissionId": "cmskfpd47000fx6p2w5qkhnld", "title": "Submission QKHNLD", "payload": {"code": "def noisy_range(n):\n for i in range(n):\n print(\"yielding\", i)\n yield i\n\ndef demo_lazy():\n gen = noisy_range(3)\n print(\"created\")\n first = next(gen)\n print(\"got\", first)\n return list(gen)", "input": "demo_lazy()", "language": "Python", "predicted_output": "created\nyielding 0\ngot 0\nyielding 1\nyielding 2\n[1, 2]"}}
{"submissionId": "cmskfpd47000gx6p29j30ysdj", "title": "Submission 30YSDJ", "payload": {"code": "def demo_next_default():\n it = iter([10, 20])\n a = next(it)\n b = next(it)\n c = next(it, \"empty\")\n try:\n next(it)\n d = \"no error\"\n except StopIteration:\n d = \"StopIteration\"\n return (a, b, c, d)", "input": "demo_next_default()", "language": "Python", "predicted_output": "(10, 20, 'empty', 'StopIteration')"}}
{"submissionId": "cmskfpd47000hx6p2cnnrr8b4", "title": "Submission NRR8B4", "payload": {"code": "def demo_generator_expr():\n squares = (x * x for x in range(4))\n first_pass = list(squares)\n second_pass = list(squares)\n return (first_pass, second_pass)", "input": "demo_generator_expr()", "language": "Python", "predicted_output": "([0, 1, 4, 9], [])"}}
{"submissionId": "cmskfpd47000ix6p20pacmnuw", "title": "Submission ACMNUW", "payload": {"code": "from itertools import accumulate, chain, islice\n\ndef demo_itertools():\n running = list(accumulate([1, 2, 3, 4]))\n joined = list(chain([1, 2], \"ab\"))\n window = list(islice(range(10), 2, 7, 2))\n return (running, joined, window)", "input": "demo_itertools()", "language": "Python", "predicted_output": "([1, 3, 6, 10], [1, 2, 'a', 'b'], [2, 4, 6])"}}
{"submissionId": "cmskfpd47000jx6p2kajq3aon", "title": "Submission JQ3AON", "payload": {"code": "def demo_zip_truncate():\n names = [\"a\", \"b\", \"c\"]\n scores = [1, 2]\n paired = list(zip(names, scores))\n unzipped = list(zip(*paired))\n return (paired, unzipped)", "input": "demo_zip_truncate()", "language": "Python", "predicted_output": "([('a', 1), ('b', 2)], [('a', 'b'), (1, 2)])"}}
{"submissionId": "cmskfpd47000kx6p2it2r85a5", "title": "Submission 2R85A5", "payload": {"code": "def truthy(value):\n print(\"checking\", value)\n return value > 2\n\ndef demo_short_circuit():\n any_result = any(truthy(v) for v in [1, 3, 5])\n print(\"---\")\n all_result = all(truthy(v) for v in [3, 1, 5])\n return (any_result, all_result)", "input": "demo_short_circuit()", "language": "Python", "predicted_output": "checking 1\nchecking 3\n---\nchecking 3\nchecking 1\n(True, False)"}}
{"submissionId": "cmskfpd47000lx6p2pn9rllgy", "title": "Submission 9RLLGY", "payload": {"code": "def demo_sort_stability():\n rows = [(\"b\", 2), (\"a\", 2), (\"c\", 1)]\n by_number = sorted(rows, key=lambda r: r[1])\n in_place = list(rows)\n returned = in_place.sort()\n return (by_number, returned, in_place)", "input": "demo_sort_stability()", "language": "Python", "predicted_output": "([('c', 1), ('b', 2), ('a', 2)], None, [('a', 2), ('b', 2), ('c', 1)])"}}
{"submissionId": "cmskfpd47000mx6p2eh1owurq", "title": "Submission 1OWURQ", "payload": {"code": "def demo_dict_comprehension():\n pairs = [(\"a\", 1), (\"b\", 2), (\"a\", 3)]\n collapsed = {k: v for k, v in pairs}\n merged = {**{\"a\": 0, \"z\": 9}, **collapsed}\n return (collapsed, merged, len(pairs))", "input": "demo_dict_comprehension()", "language": "Python", "predicted_output": "({'a': 3, 'b': 2}, {'a': 3, 'z': 9, 'b': 2}, 3)"}}
{"submissionId": "cmskfpd47000nx6p27w17ork7", "title": "Submission 17ORK7", "payload": {"code": "def demo_dict_removal():\n data = {\"a\": 1, \"b\": 2, \"c\": 3}\n popped = data.pop(\"b\")\n missing = data.pop(\"zz\", \"default\")\n last = data.popitem()\n return (popped, missing, last, data)", "input": "demo_dict_removal()", "language": "Python", "predicted_output": "(2, 'default', ('c', 3), {'a': 1})"}}
{"submissionId": "cmskfpd47000ox6p2dkksi4nv", "title": "Submission KSI4NV", "payload": {"code": "def demo_slice_assign():\n nums = [0, 1, 2, 3, 4, 5]\n nums[1:3] = [\"a\", \"b\", \"c\"]\n copy = nums[:]\n nums[::2] = [None] * len(nums[::2])\n return (copy, nums)", "input": "demo_slice_assign()", "language": "Python", "predicted_output": "([0, 'a', 'b', 'c', 3, 4, 5], [None, 'a', None, 'c', None, 4, None])"}}
{"submissionId": "cmskfpd48000px6p2v14vqo4a", "title": "Submission 4VQO4A", "payload": {"code": "def demo_repeated_refs():\n shared = [[]] * 3\n shared[0].append(\"x\")\n independent = [[] for _ in range(3)]\n independent[0].append(\"y\")\n return (shared, independent, shared[1] is shared[2])", "input": "demo_repeated_refs()", "language": "Python", "predicted_output": "([['x'], ['x'], ['x']], [['y'], [], []], True)"}}
{"submissionId": "cmskfpd48000qx6p2n2wi82p4", "title": "Submission WI82P4", "payload": {"code": "def demo_tuple_mutation():\n holder = ([1], \"fixed\")\n try:\n holder[0] += [2]\n outcome = \"no error\"\n except TypeError as exc:\n outcome = type(exc).__name__\n return (outcome, holder)", "input": "demo_tuple_mutation()", "language": "Python", "predicted_output": "('TypeError', ([1, 2], 'fixed'))"}}
{"submissionId": "cmskfpd48000rx6p2ub50qz4y", "title": "Submission 50QZ4Y", "payload": {"code": "def demo_unpacking():\n first, *middle, last = [1, 2, 3, 4, 5]\n (a, b), c = (1, 2), 3\n return (first, middle, last, a, b, c)", "input": "demo_unpacking()", "language": "Python", "predicted_output": "(1, [2, 3, 4], 5, 1, 2, 3)"}}
{"submissionId": "cmskfpd48000sx6p2gt75dfwh", "title": "Submission 75DFWH", "payload": {"code": "def demo_floor_division():\n return (\n 7 // 2, -7 // 2,\n 7 % 3, -7 % 3,\n divmod(-7, 2),\n )", "input": "demo_floor_division()", "language": "Python", "predicted_output": "(3, -4, 1, 2, (-4, 1))"}}
{"submissionId": "cmskfpd48000tx6p25c19vws9", "title": "Submission 19VWS9", "payload": {"code": "def demo_rounding():\n return (round(0.5), round(1.5), round(2.5), round(2.675, 2), round(-1.5))", "input": "demo_rounding()", "language": "Python", "predicted_output": "(0, 2, 2, 2.67, -2)"}}
{"submissionId": "cmskfpd48000ux6p22d5tlcj7", "title": "Submission 5TLCJ7", "payload": {"code": "def demo_float_precision():\n total = 0.1 + 0.2\n return (total, total == 0.3, abs(total - 0.3) < 1e-9, 1 / 3)", "input": "demo_float_precision()", "language": "Python", "predicted_output": "(0.30000000000000004, False, True, 0.3333333333333333)"}}
{"submissionId": "cmskfpd48000vx6p2qp65b639", "title": "Submission 65B639", "payload": {"code": "def demo_string_methods():\n raw = \" Report-2024-final.txt \"\n trimmed = raw.strip()\n return (\n trimmed.split(\"-\"),\n trimmed.rsplit(\"-\", 1),\n trimmed.replace(\"-\", \"_\", 1),\n trimmed.endswith(\".txt\"),\n )", "input": "demo_string_methods()", "language": "Python", "predicted_output": "(['Report', '2024', 'final.txt'], ['Report-2024', 'final.txt'], 'Report_2024-final.txt', True)"}}
{"submissionId": "cmskfpd48000wx6p29wilm6gc", "title": "Submission ILM6GC", "payload": {"code": "def demo_formatting():\n value = 3.14159\n name = \"pi\"\n return (\n \"{:.2f}\".format(value),\n \"{:>8}\".format(name),\n \"{:08.3f}\".format(value),\n f\"{name:*^9}\",\n )", "input": "demo_formatting()", "language": "Python", "predicted_output": "('3.14', ' pi', '0003.142', '***pi****')"}}
{"submissionId": "cmskfpd48000xx6p26i7nnib7", "title": "Submission 7NNIB7", "payload": {"code": "import re\n\ndef demo_regex():\n text = \"id=12, id=345, name=ada\"\n numbers = re.findall(r\"id=(\\d+)\", text)\n masked = re.sub(r\"\\d+\", \"#\", text)\n match = re.search(r\"name=(\\w+)\", text)\n return (numbers, masked, match.group(1), match.span())", "input": "demo_regex()", "language": "Python", "predicted_output": "(['12', '345'], 'id=#, id=#, name=ada', 'ada', (15, 23))"}}
{"submissionId": "cmskfpd48000yx6p27d6tmmfu", "title": "Submission 6TMMFU", "payload": {"code": "import json\n\ndef demo_json():\n payload = {\"b\": 2, \"a\": [1, {\"c\": None}], \"flag\": True}\n text = json.dumps(payload, sort_keys=True)\n restored = json.loads(text)\n return (text, restored[\"a\"][1][\"c\"], restored == payload)", "input": "demo_json()", "language": "Python", "predicted_output": "('{\"a\": [1, {\"c\": null}], \"b\": 2, \"flag\": true}', None, True)"}}
{"submissionId": "cmskfpd48000zx6p2kejqm7xx", "title": "Submission JQM7XX", "payload": {"code": "def make_counter():\n count = 0\n\n def bump():\n nonlocal count\n count += 1\n return count\n\n return bump\n\ndef demo_nonlocal():\n first = make_counter()\n second = make_counter()\n return (first(), first(), second())", "input": "demo_nonlocal()", "language": "Python", "predicted_output": "(1, 2, 1)"}}
{"submissionId": "cmskfpd480010x6p2wy5lhlet", "title": "Submission 5LHLET", "payload": {"code": "def classify(n):\n for candidate in range(2, n):\n if n % candidate == 0:\n return (\"composite\", candidate)\n else:\n return (\"prime\", None)\n\ndef demo_for_else():\n return (classify(9), classify(7))", "input": "demo_for_else()", "language": "Python", "predicted_output": "(('composite', 3), ('prime', None))"}}
{"submissionId": "cmskfpd480011x6p2zei9p4qw", "title": "Submission I9P4QW", "payload": {"code": "def demo_try_else():\n log = []\n for raw in [\"5\", \"oops\"]:\n try:\n value = int(raw)\n except ValueError:\n log.append(\"except\")\n else:\n log.append(\"else:\" + str(value))\n finally:\n log.append(\"finally\")\n return log", "input": "demo_try_else()", "language": "Python", "predicted_output": "['else:5', 'finally', 'except', 'finally']"}}
{"submissionId": "cmskfpd480012x6p25xexstzj", "title": "Submission EXSTZJ", "payload": {"code": "def demo_walrus():\n readings = [4, 8, 1, 9]\n kept = []\n while readings and (current := readings.pop(0)) < 9:\n kept.append(current)\n return (kept, readings, current)", "input": "demo_walrus()", "language": "Python", "predicted_output": "([4, 8, 1], [], 9)"}}
{"submissionId": "cmskfpd480013x6p2eg5i0jjb", "title": "Submission 5I0JJB", "payload": {"code": "def tally(*args, sep=\"-\", **kwargs):\n return (args, sep, sorted(kwargs.items()))\n\ndef demo_signature():\n return (tally(1, 2, sep=\"+\", mode=\"fast\"), tally())", "input": "demo_signature()", "language": "Python", "predicted_output": "(((1, 2), '+', [('mode', 'fast')]), ((), '-', []))"}}
{"submissionId": "cmsms65yl0015dmp2r0v8hlyy", "title": "Submission V8HLYY", "payload": {"code": "def fib_memo(n, cache={}):\n if n in cache:\n return cache[n]\n if n <= 1:\n return n\n cache[n] = fib_memo(n - 1, cache) + fib_memo(n - 2, cache)\n return cache[n]\n\ndef fib_sequence(count):\n return [fib_memo(i) for i in range(count)]", "input": "fib_sequence(10)", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]"}}
{"submissionId": "cmsms65yl0016dmp2h7cwgkzy", "title": "Submission CWGKZY", "payload": {"code": "class Stack:\n def __init__(self):\n self._items = []\n def push(self, item):\n self._items.append(item)\n def pop(self):\n return self._items.pop()\n def __repr__(self):\n return f\"Stack({self._items})\"\n\ndef use_stack():\n s = Stack()\n for i in [1, 2, 3]:\n s.push(i * i)\n s.pop()\n return s", "input": "use_stack()", "language": "Python", "predicted_output": "Stack([1, 4])"}}
{"submissionId": "cmsms65yl0018dmp2el6rff6e", "title": "Submission 6RFF6E", "payload": {"code": "def flatten(nested):\n result = []\n for item in nested:\n if isinstance(item, list):\n result.extend(flatten(item))\n else:\n result.append(item)\n return result", "input": "flatten([1, [2, 3, [4, [5, 6]], 7], 8])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7, 8]"}}
{"submissionId": "cmsms65yl001cdmp2iet1jnom", "title": "Submission T1JNOM", "payload": {"code": "class Node:\n def __init__(self, value, next=None):\n self.value = value\n self.next = next\n\ndef linked_list_to_list(head):\n out = []\n while head:\n out.append(head.value)\n head = head.next\n return out\n\ndef build_and_walk():\n head = Node(1, Node(2, Node(3, Node(4))))\n return linked_list_to_list(head)", "input": "build_and_walk()", "language": "Python", "predicted_output": "[1, 2, 3, 4]"}}
{"submissionId": "cmsms65yl001edmp2hgo5ornw", "title": "Submission O5ORNW", "payload": {"code": "def custom_sort(records):\n return sorted(records, key=lambda r: (-r[1], r[0]))", "input": "custom_sort([(\"apple\", 3), (\"banana\", 5), (\"cherry\", 3), (\"date\", 5)])", "language": "Python", "predicted_output": "[('banana', 5), ('date', 5), ('apple', 3), ('cherry', 3)]"}}
{"submissionId": "cmsms65yl001fdmp242km4ilp", "title": "Submission KM4ILP", "payload": {"code": "def try_finally_demo(x):\n log = []\n try:\n if x < 0:\n raise ValueError(\"negative\")\n log.append(\"processed\")\n return x * 2\n except ValueError as e:\n log.append(f\"error: {e}\")\n return -1\n finally:\n log.append(\"cleanup\")\n return log", "input": "try_finally_demo(-5)", "language": "Python", "predicted_output": "-1"}}
{"submissionId": "cmsms65yl001gdmp272796quj", "title": "Submission 796QUJ", "payload": {"code": "def make_counter():\n count = 0\n def increment(step=1):\n nonlocal count\n count += step\n return count\n return increment\n\ndef run_counter():\n inc = make_counter()\n inc(3)\n inc(2)\n return inc(5)", "input": "run_counter()", "language": "Python", "predicted_output": "10"}}
{"submissionId": "cmsms65yl001idmp2po1v4lzd", "title": "Submission 1V4LZD", "payload": {"code": "def apply_decorator():\n def logged(func):\n calls = []\n def wrapper(*args, **kwargs):\n result = func(*args, **kwargs)\n calls.append((args, result))\n return result\n wrapper.calls = calls\n return wrapper\n\n @logged\n def square(x):\n return x * x\n\n square(2)\n square(3)\n square(4)\n return square.calls", "input": "apply_decorator()", "language": "Python", "predicted_output": "[((2,), 4), ((3,), 9), ((4,), 16)]"}}
{"submissionId": "cmsms65yl001kdmp2w35m9my5", "title": "Submission 5M9MY5", "payload": {"code": "def default_arg_pitfall(value, bucket=[]):\n bucket.append(value)\n return bucket\n\ndef run_pitfall():\n a = default_arg_pitfall(1)\n b = default_arg_pitfall(2)\n return a, b", "input": "run_pitfall()", "language": "Python", "predicted_output": "([1, 2], [1, 2])"}}
{"submissionId": "cmsms65yl001ldmp27xl7ddf4", "title": "Submission L7DDF4", "payload": {"code": "def chained_comparisons(a, b, c):\n return a < b < c, a < b > c", "input": "chained_comparisons(1, 5, 10)", "language": "Python", "predicted_output": "(True, False)"}}
{"submissionId": "cmsms65yl001mdmp253fhlc9x", "title": "Submission FHLC9X", "payload": {"code": "class Animal:\n def speak(self):\n return \"...\"\n\nclass Dog(Animal):\n def speak(self):\n return \"Woof\"\n\nclass Cat(Animal):\n def speak(self):\n return \"Meow\"\n\ndef speak_all(animals):\n return [a.speak() for a in animals]", "input": "speak_all([Dog(), Cat(), Animal()])", "language": "Python", "predicted_output": "['Woof', 'Meow', '...']"}}
{"submissionId": "cmsms65yl001odmp2u9t9o5sk", "title": "Submission T9O5SK", "payload": {"code": "def walrus_demo(nums):\n result = []\n i = 0\n while (n := nums[i] if i < len(nums) else None) is not None:\n result.append(n * 2)\n i += 1\n return result", "input": "walrus_demo([1, 2, 3])", "language": "Python", "predicted_output": "[2, 4, 6]"}}
{"submissionId": "cmsms65yl001pdmp28w0q1k9v", "title": "Submission 0Q1K9V", "payload": {"code": "from collections import namedtuple\nPoint = namedtuple(\"Point\", [\"x\", \"y\"])\n\ndef sum_points(points):\n total_x = sum(p.x for p in points)\n total_y = sum(p.y for p in points)\n return Point(total_x, total_y)", "input": "sum_points([Point(1, 2), Point(3, 4), Point(5, 6)])", "language": "Python", "predicted_output": "Point(x=9, y=12)"}}
{"submissionId": "cmsms65yl001rdmp21hfk09gv", "title": "Submission FK09GV", "payload": {"code": "def generator_pipeline(n):\n def squares():\n for i in range(n):\n yield i * i\n return list(x for x in squares() if x % 2 == 0)", "input": "generator_pipeline(10)", "language": "Python", "predicted_output": "[0, 4, 16, 36, 64]"}}
{"submissionId": "cmsms65yl001sdmp2givupg1f", "title": "Submission VUPG1F", "payload": {"code": "class Temperature:\n def __init__(self, celsius):\n self._celsius = celsius\n\n @property\n def fahrenheit(self):\n return self._celsius * 9 / 5 + 32\n\n @fahrenheit.setter\n def fahrenheit(self, value):\n self._celsius = (value - 32) * 5 / 9\n\ndef convert_round_trip():\n t = Temperature(25)\n f = t.fahrenheit\n t.fahrenheit = 100\n return round(f, 2), round(t._celsius, 2)", "input": "convert_round_trip()", "language": "Python", "predicted_output": "(77.0, 37.78)"}}
{"submissionId": "cmsms65yl001tdmp26yej0i1k", "title": "Submission EJ0I1K", "payload": {"code": "def custom_exception_demo():\n class InsufficientFundsError(Exception):\n def __init__(self, balance, amount):\n self.balance = balance\n self.amount = amount\n super().__init__(f\"Cannot withdraw {amount}, balance is {balance}\")\n\n def withdraw(balance, amount):\n if amount > balance:\n raise InsufficientFundsError(balance, amount)\n return balance - amount\n\n try:\n withdraw(50, 100)\n except InsufficientFundsError as e:\n return str(e), e.balance, e.amount", "input": "custom_exception_demo()", "language": "Python", "predicted_output": "('Cannot withdraw 100, balance is 50', 50, 100)"}}
{"submissionId": "cmsms65yl001udmp2lkajjzn0", "title": "Submission AJJZN0", "payload": {"code": "def binary_search(arr, target):\n lo, hi = 0, len(arr) - 1\n while lo <= hi:\n mid = (lo + hi) // 2\n if arr[mid] == target:\n return mid\n elif arr[mid] < target:\n lo = mid + 1\n else:\n hi = mid - 1\n return -1", "input": "binary_search([1, 3, 5, 7, 9, 11, 13], 9)", "language": "Python", "predicted_output": "4"}}
{"submissionId": "cmsms65ym001wdmp2pm5n7obm", "title": "Submission 5N7OBM", "payload": {"code": "import itertools\ndef pairwise_products(nums):\n return [a * b for a, b in itertools.combinations(nums, 2)]", "input": "pairwise_products([1, 2, 3, 4])", "language": "Python", "predicted_output": "[2, 3, 4, 6, 8, 12]"}}
{"submissionId": "cmsms65ym001ydmp2xg18vj5g", "title": "Submission 18VJ5G", "payload": {"code": "class Vector:\n def __init__(self, x, y):\n self.x, self.y = x, y\n def __add__(self, other):\n return Vector(self.x + other.x, self.y + other.y)\n def __eq__(self, other):\n return self.x == other.x and self.y == other.y\n def __repr__(self):\n return f\"Vector({self.x}, {self.y})\"\n\ndef add_vectors():\n v1 = Vector(1, 2)\n v2 = Vector(3, 4)\n return v1 + v2", "input": "add_vectors()", "language": "Python", "predicted_output": "Vector(4, 6)"}}
{"submissionId": "cmsms65ym001zdmp2lspm4jta", "title": "Submission PM4JTA", "payload": {"code": "def recursive_sum_digits(n):\n if n < 10:\n return n\n return n % 10 + recursive_sum_digits(n // 10)", "input": "recursive_sum_digits(987654)", "language": "Python", "predicted_output": "39"}}
{"submissionId": "cmsms65ym0020dmp25eg7nx6x", "title": "Submission G7NX6X", "payload": {"code": "def slicing_tricks(lst):\n return lst[::2], lst[::-1], lst[1:-1], lst[-3:]", "input": "slicing_tricks([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])", "language": "Python", "predicted_output": "([0, 2, 4, 6, 8], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [1, 2, 3, 4, 5, 6, 7, 8], [7, 8, 9])"}}
{"submissionId": "cmsms65ym0021dmp2fu55zszn", "title": "Submission 55ZSZN", "payload": {"code": "def context_manager_demo():\n class Resource:\n def __init__(self, name):\n self.name = name\n self.log = []\n def __enter__(self):\n self.log.append(f\"open:{self.name}\")\n return self\n def __exit__(self, exc_type, exc_val, exc_tb):\n self.log.append(f\"close:{self.name}\")\n return False\n\n r = Resource(\"db\")\n with r:\n r.log.append(\"using\")\n return r.log", "input": "context_manager_demo()", "language": "Python", "predicted_output": "['open:db', 'using', 'close:db']"}}
{"submissionId": "cmsms65ym0022dmp2202rqi5h", "title": "Submission 2RQI5H", "payload": {"code": "def deep_update(base, updates):\n for key, value in updates.items():\n if isinstance(value, dict) and isinstance(base.get(key), dict):\n deep_update(base[key], value)\n else:\n base[key] = value\n return base", "input": "deep_update({'a': 1, 'b': {'c': 2, 'd': 3}}, {'b': {'c': 20, 'e': 4}, 'f': 5})", "language": "Python", "predicted_output": "{'a': 1, 'b': {'c': 20, 'd': 3, 'e': 4}, 'f': 5}"}}
{"submissionId": "cmsms65ym0024dmp2jsgsbo3f", "title": "Submission GSBO3F", "payload": {"code": "def lru_style_cache():\n from functools import lru_cache\n\n calls = []\n\n @lru_cache(maxsize=None)\n def expensive(n):\n calls.append(n)\n return n * n\n\n expensive(4)\n expensive(4)\n expensive(5)\n expensive(4)\n return calls, expensive(5)", "input": "lru_style_cache()", "language": "Python", "predicted_output": "([4, 5], 25)"}}
{"submissionId": "cmsms65ym0025dmp2hbik6tq3", "title": "Submission IK6TQ3", "payload": {"code": "def validate_and_transform(records):\n valid = []\n errors = []\n for r in records:\n try:\n age = int(r[\"age\"])\n if age < 0:\n raise ValueError(\"negative age\")\n valid.append({\"name\": r[\"name\"], \"age\": age})\n except (KeyError, ValueError) as e:\n errors.append(str(e))\n return valid, errors", "input": "validate_and_transform([{\"name\": \"A\", \"age\": \"30\"}, {\"name\": \"B\", \"age\": \"-5\"}, {\"name\": \"C\"}])", "language": "Python", "predicted_output": "([{'name': 'A', 'age': 30}], ['negative age', \"'age'\"])"}}
{"submissionId": "cmsms65ym0027dmp2wyqlwn0p", "title": "Submission QLWN0P", "payload": {"code": "class ReadOnlyDict:\n def __init__(self, data):\n self._data = dict(data)\n def __getitem__(self, key):\n return self._data[key]\n def __setitem__(self, key, value):\n raise TypeError(\"read-only\")\n def __repr__(self):\n return f\"ReadOnlyDict({self._data})\"\n\ndef try_mutate():\n d = ReadOnlyDict({\"a\": 1})\n try:\n d[\"a\"] = 2\n except TypeError as e:\n return str(e), d[\"a\"]", "input": "try_mutate()", "language": "Python", "predicted_output": "('read-only', 1)"}}
{"submissionId": "cmsms65ym0029dmp2fn3fu20h", "title": "Submission 3FU20H", "payload": {"code": "def sort_stability_demo(items):\n return sorted(items, key=lambda x: x[0])", "input": "sort_stability_demo([(1, \"a\"), (2, \"b\"), (1, \"c\"), (2, \"d\"), (1, \"e\")])", "language": "Python", "predicted_output": "[(1, 'a'), (1, 'c'), (1, 'e'), (2, 'b'), (2, 'd')]"}}
{"submissionId": "cmsms65ym002admp2k44z2fdq", "title": "Submission 4Z2FDQ", "payload": {"code": "def exception_chaining_demo():\n def parse(value):\n try:\n return int(value)\n except ValueError as e:\n raise RuntimeError(\"parse failed\") from e\n\n try:\n parse(\"abc\")\n except RuntimeError as e:\n return str(e), type(e.__cause__).__name__", "input": "exception_chaining_demo()", "language": "Python", "predicted_output": "('parse failed', 'ValueError')"}}
{"submissionId": "cmsms65ym002cdmp20zjm36jy", "title": "Submission JM36JY", "payload": {"code": "def kwargs_and_args_demo(*args, **kwargs):\n return sum(args) + sum(kwargs.values()), sorted(kwargs.keys())", "input": "kwargs_and_args_demo(1, 2, 3, x=10, y=20)", "language": "Python", "predicted_output": "(36, ['x', 'y'])"}}
{"submissionId": "cmsms65ym002edmp24r7p7ur2", "title": "Submission 7P7UR2", "payload": {"code": "def find_duplicates_with_index(items):\n seen = {}\n dupes = []\n for i, item in enumerate(items):\n if item in seen:\n dupes.append((item, seen[item], i))\n else:\n seen[item] = i\n return dupes", "input": "find_duplicates_with_index([\"a\", \"b\", \"a\", \"c\", \"b\", \"b\"])", "language": "Python", "predicted_output": "[('a', 0, 2), ('b', 1, 4), ('b', 1, 5)]"}}
{"submissionId": "cmsms65ym002fdmp2sv8l9ze7", "title": "Submission 8L9ZE7", "payload": {"code": "def class_method_and_static_demo():\n class Circle:\n pi = 3.14159\n def __init__(self, radius):\n self.radius = radius\n @classmethod\n def unit_circle(cls):\n return cls(1)\n @staticmethod\n def area_for(radius):\n return Circle.pi * radius * radius\n def area(self):\n return Circle.area_for(self.radius)\n\n c = Circle.unit_circle()\n return c.area(), Circle.area_for(3)", "input": "class_method_and_static_demo()", "language": "Python", "predicted_output": "(3.14159, 28.274309999999996)"}}
{"submissionId": "cmsmt31me0037dmp2dnd6rlsg", "title": "Submission D6RLSG", "payload": {"code": "def safe_divs(pairs):\n out = []\n for a, b in pairs:\n try:\n out.append(round(a / b, 3))\n except ZeroDivisionError:\n out.append(None)\n return out", "input": "safe_divs([(10, 4), (1, 0)])", "language": "Python", "predicted_output": "[2.5, None]"}}
{"submissionId": "cmsmt31me0038dmp2g8ln771t", "title": "Submission LN771T", "payload": {"code": "def flatten(nested):\n out = []\n for item in nested:\n if isinstance(item, list):\n out.extend(item)\n else:\n out.append(item)\n return out", "input": "flatten([1, [2, 3], 4, [5]])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5]"}}
{"submissionId": "cmsmt31me0039dmp2sd0scuw6", "title": "Submission 0SCUW6", "payload": {"code": "def group_parity(nums):\n groups = {'even': [], 'odd': []}\n for n in nums:\n groups['even' if n % 2 == 0 else 'odd'].append(n)\n return groups", "input": "group_parity([1, 2, 3, 4, 5])", "language": "Python", "predicted_output": "{'even': [2, 4], 'odd': [1, 3, 5]}"}}
{"submissionId": "cmsmt31me003admp23gvj9ios", "title": "Submission VJ9IOS", "payload": {"code": "def unique_sorted(items):\n return sorted(set(items))", "input": "unique_sorted([3, 1, 2, 3, 1, 4])", "language": "Python", "predicted_output": "[1, 2, 3, 4]"}}
{"submissionId": "cmsmt31me003bdmp2q8mw3cbt", "title": "Submission MW3CBT", "payload": {"code": "def word_lengths(sentence):\n return {w: len(w) for w in sentence.split()}", "input": "word_lengths('the quick brown')", "language": "Python", "predicted_output": "{'the': 3, 'quick': 5, 'brown': 5}"}}
{"submissionId": "cmsmt31me003cdmp2aso8su1o", "title": "Submission O8SU1O", "payload": {"code": "def clamp_all(values, low, high):\n return [max(low, min(v, high)) for v in values]", "input": "clamp_all([5, -3, 15], 0, 10)", "language": "Python", "predicted_output": "[5, 0, 10]"}}
{"submissionId": "cmsmt31me003ddmp2z9zdhdt7", "title": "Submission ZDHDT7", "payload": {"code": "def fib(n):\n a, b = 0, 1\n seq = []\n for _ in range(n):\n seq.append(a)\n a, b = b, a + b\n return seq", "input": "fib(7)", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8]"}}
{"submissionId": "cmsmt31me003edmp25clx0lg4", "title": "Submission LX0LG4", "payload": {"code": "def merge_dicts(a, b):\n result = dict(a)\n result.update(b)\n return result", "input": "merge_dicts({'x': 1, 'y': 2}, {'y': 9, 'z': 3})", "language": "Python", "predicted_output": "{'x': 1, 'y': 9, 'z': 3}"}}
{"submissionId": "cmsmt6sqa003hdmp2i68pnij5", "title": "Submission 8PNIJ5", "payload": {"code": "def first_letters(words):\n return [w[0] for w in words]", "input": "first_letters(['tree', 'quiet', 'brown'])", "language": "Python", "predicted_output": "['t', 'q', 'b']"}}
{"submissionId": "cmsmt6sqa003idmp2srnydpyp", "title": "Submission NYDPYP", "payload": {"code": "def running_max(nums):\n best = nums[0]\n out = []\n for n in nums:\n best = max(best, n)\n out.append(best)\n return out", "input": "running_max([1, 3, 2, 5, 4])", "language": "Python", "predicted_output": "[1, 3, 3, 5, 5]"}}
{"submissionId": "cmsmt6sqa003jdmp2a67oiimk", "title": "Submission 7OIIMK", "payload": {"code": "def dedupe_keep_order(seq):\n seen = set()\n out = []\n for x in seq:\n if x not in seen:\n seen.add(x)\n out.append(x)\n return out", "input": "dedupe_keep_order([3, 1, 3, 2, 1, 4])", "language": "Python", "predicted_output": "[3, 1, 2, 4]"}}
{"submissionId": "cmsmt6sqa003kdmp2m0ue36m9", "title": "Submission UE36M9", "payload": {"code": "def digit_sums(nums):\n return [sum(int(d) for d in str(abs(n))) for n in nums]", "input": "digit_sums([12345, -99])", "language": "Python", "predicted_output": "[15, 18]"}}
{"submissionId": "cmsmt6sqa003ldmp2fyfinuci", "title": "Submission FINUCI", "payload": {"code": "def invert_mapping(d):\n return {v: k for k, v in d.items()}", "input": "invert_mapping({'a': 1, 'b': 2, 'c': 3})", "language": "Python", "predicted_output": "{1: 'a', 2: 'b', 3: 'c'}"}}
{"submissionId": "cmsmt6sqa003ndmp27a8e4gov", "title": "Submission 8E4GOV", "payload": {"code": "def first_repeated(nums):\n seen = set()\n for n in nums:\n if n in seen:\n return n\n seen.add(n)\n return None", "input": "first_repeated([2, 4, 6, 4, 8])", "language": "Python", "predicted_output": "4"}}
{"submissionId": "cmsmt6sqa003odmp21bz19ele", "title": "Submission Z19ELE", "payload": {"code": "def normalize(scores):\n lo, hi = min(scores), max(scores)\n span = hi - lo\n return [round((s - lo) / span, 2) for s in scores]", "input": "normalize([10, 20, 30])", "language": "Python", "predicted_output": "[0.0, 0.5, 1.0]"}}
{"submissionId": "cmsmt6sqa003pdmp2a9wxm3j6", "title": "Submission WXM3J6", "payload": {"code": "def stack_ops(commands):\n stack = []\n for op in commands:\n if op == 'pop':\n stack.pop()\n else:\n stack.append(op)\n return stack", "input": "stack_ops(['a', 'b', 'pop', 'c'])", "language": "Python", "predicted_output": "['a', 'c']"}}
{"submissionId": "cmsmt6sqa003qdmp2qhof64wq", "title": "Submission OF64WQ", "payload": {"code": "def rle_encode(s):\n if not s:\n return []\n out = []\n prev = s[0]\n count = 1\n for ch in s[1:]:\n if ch == prev:\n count += 1\n else:\n out.append((prev, count))\n prev = ch\n count = 1\n out.append((prev, count))\n return out", "input": "rle_encode('aaabbc')", "language": "Python", "predicted_output": "[('a', 3), ('b', 2), ('c', 1)]"}}
{"submissionId": "cmsmt6sqa003rdmp2tdati42s", "title": "Submission ATI42S", "payload": {"code": "def price_after_tax(prices, rate):\n return [round(p * (1 + rate), 2) for p in prices]", "input": "price_after_tax([100, 250], 0.08)", "language": "Python", "predicted_output": "[108.0, 270.0]"}}
{"submissionId": "cmsmt6sqa003sdmp2cahx7s60", "title": "Submission HX7S60", "payload": {"code": "def sum_by_key(records):\n totals = {}\n for r in records:\n totals[r['cat']] = totals.get(r['cat'], 0) + r['amt']\n return totals", "input": "sum_by_key([{'cat': 'x', 'amt': 5}, {'cat': 'y', 'amt': 2}, {'cat': 'x', 'amt': 3}])", "language": "Python", "predicted_output": "{'x': 8, 'y': 2}"}}
{"submissionId": "cmsmt6sqa003tdmp2yconun9n", "title": "Submission ONUN9N", "payload": {"code": "def all_balanced(strings):\n pairs = {')': '(', ']': '[', '}': '{'}\n result = []\n for s in strings:\n stack = []\n ok = True\n for ch in s:\n if ch in '([{':\n stack.append(ch)\n elif ch in pairs:\n if not stack or stack.pop() != pairs[ch]:\n ok = False\n break\n result.append(ok and not stack)\n return result", "input": "all_balanced(['(a[b]{c})', '(]'])", "language": "Python", "predicted_output": "[True, False]"}}
{"submissionId": "cmsnc3d7k005k6zp2hj2zuiq0", "title": "Submission 2ZUIQ0", "payload": {"code": "def compact_ranges(nums):\n if not nums: return []\n out=[]; start=prev=nums[0]\n for x in nums[1:]:\n if x==prev+1: prev=x; continue\n out.append((start,prev)); start=prev=x\n out.append((start,prev)); return out", "input": "compact_ranges([1,2,3,5,8,9])", "language": "Python", "predicted_output": "[(1, 3), (5, 5), (8, 9)]"}}
{"submissionId": "cmsnc3d7k005l6zp2v50vvnda", "title": "Submission 0VVNDA", "payload": {"code": "def invert_counts(items):\n d={}\n for x in items: d[x]=d.get(x,0)+1\n return sorted((v,k) for k,v in d.items())", "input": "invert_counts(['b','a','b','c','a','b'])", "language": "Python", "predicted_output": "[(1, 'c'), (2, 'a'), (3, 'b')]"}}
{"submissionId": "cmsnc3d7k005m6zp23fioo3ow", "title": "Submission IOO3OW", "payload": {"code": "def zigzag(nums):\n return [x if i%2==0 else -x for i,x in enumerate(nums)]", "input": "zigzag([4,1,-2,3])", "language": "Python", "predicted_output": "[4, -1, -2, -3]"}}
{"submissionId": "cmsnc3d7k005n6zp2csodixha", "title": "Submission ODIXHA", "payload": {"code": "def merge_defaults(defaults, override):\n out=defaults.copy(); out.update({k:v for k,v in override.items() if v is not None}); return out", "input": "merge_defaults({'a':1,'b':2},{'b':5,'c':None,'d':9})", "language": "Python", "predicted_output": "{'a': 1, 'b': 5, 'd': 9}"}}
{"submissionId": "cmsnc3d7k005o6zp2dejfcpub", "title": "Submission JFCPUB", "payload": {"code": "def window_sums(nums,k):\n if k<=0 or k>len(nums): return []\n s=sum(nums[:k]); out=[s]\n for i in range(k,len(nums)):\n s+=nums[i]-nums[i-k]; out.append(s)\n return out", "input": "window_sums([2,5,-1,4,3],3)", "language": "Python", "predicted_output": "[6, 8, 6]"}}
{"submissionId": "cmsnc3d7k005p6zp2rfqiyxyh", "title": "Submission QIYXYH", "payload": {"code": "def safe_ints(values):\n out=[]\n for v in values:\n try: out.append(int(v))\n except (ValueError,TypeError): out.append(None)\n return out", "input": "safe_ints(['12','-3','x',None,'04'])", "language": "Python", "predicted_output": "[12, -3, None, None, 4]"}}
{"submissionId": "cmsnc3d7k005q6zp2a3ly97qc", "title": "Submission LY97QC", "payload": {"code": "def transpose(rows):\n return [list(col) for col in zip(*rows)] if rows else []", "input": "transpose([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "[[1, 4], [2, 5], [3, 6]]"}}
{"submissionId": "cmsnc3d7k005r6zp2s663vi7e", "title": "Submission 63VI7E", "payload": {"code": "def unique_last(items):\n seen=set(); out=[]\n for x in reversed(items):\n if x not in seen: seen.add(x); out.append(x)\n return list(reversed(out))", "input": "unique_last(['a','b','a','c','b'])", "language": "Python", "predicted_output": "['a', 'c', 'b']"}}
{"submissionId": "cmsnc3d7k005s6zp2tb93tm85", "title": "Submission 93TM85", "payload": {"code": "def classify(nums):\n return {'neg':sum(x<0 for x in nums),'zero':sum(x==0 for x in nums),'pos':sum(x>0 for x in nums)}", "input": "classify([-2,0,3,4,0,-1])", "language": "Python", "predicted_output": "{'neg': 2, 'zero': 2, 'pos': 2}"}}
{"submissionId": "cmsnc3d7l005t6zp2orp4mrzs", "title": "Submission P4MRZS", "payload": {"code": "def rotate_matrix(m):\n return [list(row) for row in zip(*m[::-1])]", "input": "rotate_matrix([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "[[4, 1], [5, 2], [6, 3]]"}}
{"submissionId": "cmsnc3d7l005u6zp2jw9sxqku", "title": "Submission 9SXQKU", "payload": {"code": "def nested_get(obj,path,default=None):\n cur=obj\n for key in path:\n if not isinstance(cur,dict) or key not in cur: return default\n cur=cur[key]\n return cur", "input": "(nested_get({'a':{'b':7}},['a','b']), nested_get({'a':{}},['a','x'],'missing'))", "language": "Python", "predicted_output": "(7, 'missing')"}}
{"submissionId": "cmsnc3d7l005v6zp2bjn6zgkr", "title": "Submission N6ZGKR", "payload": {"code": "def rank_scores(scores):\n vals=sorted(set(scores),reverse=True)\n ranks={v:i+1 for i,v in enumerate(vals)}\n return [ranks[x] for x in scores]", "input": "rank_scores([90,70,90,50,70])", "language": "Python", "predicted_output": "[1, 2, 1, 3, 2]"}}
{"submissionId": "cmsnc3d7l005w6zp27h5yuhmv", "title": "Submission 5YUHMV", "payload": {"code": "def flatten_once(items):\n out=[]\n for x in items:\n out.extend(x if isinstance(x,list) else [x])\n return out", "input": "flatten_once([[1,2],3,[],[4,[5]]])", "language": "Python", "predicted_output": "[1, 2, 3, 4, [5]]"}}
{"submissionId": "cmsnc3d7m005x6zp2tg2qj3f3", "title": "Submission 2QJ3F3", "payload": {"code": "def diff_keys(a,b):\n keys=set(a)|set(b)\n return sorted(k for k in keys if a.get(k)!=b.get(k))", "input": "diff_keys({'a':1,'b':2,'d':None},{'a':1,'b':3,'c':4})", "language": "Python", "predicted_output": "['b', 'c']"}}
{"submissionId": "cmsnc3d7m005y6zp2mc7bf5a7", "title": "Submission 7BF5A7", "payload": {"code": "def encode_runs(s):\n if not s:return []\n out=[]; ch=s[0]; n=1\n for c in s[1:]:\n if c==ch:n+=1\n else:out.append((ch,n));ch=c;n=1\n out.append((ch,n));return out", "input": "encode_runs('aaabbccccaa')", "language": "Python", "predicted_output": "[('a', 3), ('b', 2), ('c', 4), ('a', 2)]"}}
{"submissionId": "cmsnc3d7m005z6zp2lzi01jq8", "title": "Submission I01JQ8", "payload": {"code": "def bucket(nums,size):\n out={}\n for x in nums:\n k=(x//size)*size\n out.setdefault(k,[]).append(x)\n return out", "input": "bucket([1,9,10,11,19,20],10)", "language": "Python", "predicted_output": "{0: [1, 9], 10: [10, 11, 19], 20: [20]}"}}
{"submissionId": "cmsnc3d7m00606zp277m1l1vm", "title": "Submission M1L1VM", "payload": {"code": "def pairwise_delta(nums):\n return [b-a for a,b in zip(nums,nums[1:])]", "input": "pairwise_delta([10,13,8,8,20])", "language": "Python", "predicted_output": "[3, -5, 0, 12]"}}
{"submissionId": "cmsnc3d7m00616zp205npvp25", "title": "Submission NPVP25", "payload": {"code": "def normalize_record(r):\n return {k.strip().lower(): (v.strip() if isinstance(v,str) else v) for k,v in r.items()}", "input": "normalize_record({' Name ':' Ada ','AGE':36})", "language": "Python", "predicted_output": "{'name': 'Ada', 'age': 36}"}}
{"submissionId": "cmsnc3d7m00626zp2niq0ghji", "title": "Submission Q0GHJI", "payload": {"code": "def take_until(nums,limit):\n out=[]; total=0\n for x in nums:\n if total+x>limit: break\n out.append(x); total+=x\n return out,total", "input": "take_until([3,4,5,1],10)", "language": "Python", "predicted_output": "([3, 4], 7)"}}
{"submissionId": "cmsnc3d7m00636zp2q5zkdrvj", "title": "Submission ZKDRVJ", "payload": {"code": "def intersection_ordered(a,b):\n allowed=set(b); seen=set(); out=[]\n for x in a:\n if x in allowed and x not in seen: seen.add(x); out.append(x)\n return out", "input": "intersection_ordered([3,1,2,3,4,2],[2,3,9])", "language": "Python", "predicted_output": "[3, 2]"}}
{"submissionId": "cmso86qn900ak6zp2ou1ubwfs", "title": "Submission 1UBWFS", "payload": {"code": "def f(xs):\n return [x*x for x in xs if x%2]", "input": "f([1,2,3,4,5])", "language": "Python", "predicted_output": "[1, 9, 25]"}}
{"submissionId": "cmso86qn900al6zp2ieg6wc71", "title": "Submission G6WC71", "payload": {"code": "def f(s):\n return {c:s.count(c) for c in sorted(set(s))}", "input": "f('banana')", "language": "Python", "predicted_output": "{'a': 3, 'b': 1, 'n': 2}"}}
{"submissionId": "cmso86qn900am6zp2o1017uh4", "title": "Submission 017UH4", "payload": {"code": "def f(xs):\n a=0\n for i,x in enumerate(xs): a+=i*x\n return a", "input": "f([3,4,5])", "language": "Python", "predicted_output": "14"}}
{"submissionId": "cmso86qn900an6zp22woinimi", "title": "Submission OINIMI", "payload": {"code": "def f(n):\n return sum(i for i in range(n+1) if i%3==0)", "input": "f(10)", "language": "Python", "predicted_output": "18"}}
{"submissionId": "cmso86qn900ao6zp2ao3ifi6i", "title": "Submission 3IFI6I", "payload": {"code": "def f(d):\n return sorted(d.items(), key=lambda p:(-p[1],p[0]))", "input": "f({'b':2,'a':2,'c':1})", "language": "Python", "predicted_output": "[('a', 2), ('b', 2), ('c', 1)]"}}
{"submissionId": "cmso86qn900ap6zp2pgftznkt", "title": "Submission FTZNKT", "payload": {"code": "def f(xs):\n return list(zip(xs,xs[1:]))", "input": "f([4,7,9])", "language": "Python", "predicted_output": "[(4, 7), (7, 9)]"}}
{"submissionId": "cmso86qna00ar6zp21dgmzedj", "title": "Submission GMZEDJ", "payload": {"code": "def f(xs):\n return [sum(xs[:i]) for i in range(len(xs)+1)]", "input": "f([2,-1,3])", "language": "Python", "predicted_output": "[0, 2, 1, 4]"}}
{"submissionId": "cmso86qna00as6zp27fkmefbi", "title": "Submission KMEFBI", "payload": {"code": "def f(n):\n a,b=0,1\n for _ in range(n): a,b=b,a+b\n return a", "input": "f(8)", "language": "Python", "predicted_output": "21"}}
{"submissionId": "cmso86qna00at6zp2epzu6444", "title": "Submission ZU6444", "payload": {"code": "def f(xs):\n return max(enumerate(xs),key=lambda p:p[1])", "input": "f([5,9,9,2])", "language": "Python", "predicted_output": "(1, 9)"}}
{"submissionId": "cmso86qna00au6zp20n1dn9eb", "title": "Submission 1DN9EB", "payload": {"code": "def f(s):\n return s[::2],s[1::2]", "input": "f('abcdefg')", "language": "Python", "predicted_output": "('aceg', 'bdf')"}}
{"submissionId": "cmso86qna00av6zp2dqeifczh", "title": "Submission EIFCZH", "payload": {"code": "def f(xs):\n return all(a<=b for a,b in zip(xs,xs[1:]))", "input": "f([1,1,3,2])", "language": "Python", "predicted_output": "False"}}
{"submissionId": "cmso86qna00aw6zp2r24f0blp", "title": "Submission 4F0BLP", "payload": {"code": "def f(xs):\n return sorted(set(xs), reverse=True)[1]", "input": "f([4,1,4,3,2])", "language": "Python", "predicted_output": "3"}}
{"submissionId": "cmso86qna00ax6zp2tv6a5vwz", "title": "Submission 6A5VWZ", "payload": {"code": "def f(s):\n from collections import Counter\n return Counter(s).most_common(2)", "input": "f('mississippi')", "language": "Python", "predicted_output": "[('i', 4), ('s', 4)]"}}
{"submissionId": "cmso86qna00ay6zp2l56j8bab", "title": "Submission 6J8BAB", "payload": {"code": "def f(x):\n try:return 100//x\n except ZeroDivisionError:return None", "input": "(f(4),f(0))", "language": "Python", "predicted_output": "(25, None)"}}
{"submissionId": "cmso86qna00az6zp2lezxzmbm", "title": "Submission ZXZMBM", "payload": {"code": "def f(xs):\n return {x:i for i,x in enumerate(xs)}", "input": "f(['a','b','a'])", "language": "Python", "predicted_output": "{'a': 2, 'b': 1}"}}
{"submissionId": "cmso86qna00b06zp2zd2n1ugx", "title": "Submission 2N1UGX", "payload": {"code": "def f(n):\n return [i for i in range(n) if all(i%d for d in range(2,int(i**.5)+1)) and i>1]", "input": "f(12)", "language": "Python", "predicted_output": "[2, 3, 5, 7, 11]"}}
{"submissionId": "cmso86qna00b16zp274gz4vu3", "title": "Submission GZ4VU3", "payload": {"code": "def f(rows):\n return list(map(list,zip(*rows)))", "input": "f([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "[[1, 4], [2, 5], [3, 6]]"}}
{"submissionId": "cmso86qna00b36zp2amh9wsg9", "title": "Submission H9WSG9", "payload": {"code": "def f(xs):\n return [x for x in xs if xs.count(x)==1]", "input": "f([1,2,1,3,4,3])", "language": "Python", "predicted_output": "[2, 4]"}}
{"submissionId": "cmso86qna00b46zp2vsn4gdtl", "title": "Submission N4GDTL", "payload": {"code": "def f(n):\n return divmod(n,60)", "input": "f(367)", "language": "Python", "predicted_output": "(6, 7)"}}
{"submissionId": "cmso86qna00b56zp2fjgg13to", "title": "Submission GG13TO", "payload": {"code": "def f(xs):\n return min(xs,key=lambda x:(abs(x),x))", "input": "f([-3,2,-2,5])", "language": "Python", "predicted_output": "-2"}}
{"submissionId": "cmso86qna00b66zp2fsd9xno7", "title": "Submission D9XNO7", "payload": {"code": "def f(s):\n return [p for p in s.split(',') if p]", "input": "f('a,,b,c,')", "language": "Python", "predicted_output": "['a', 'b', 'c']"}}
{"submissionId": "cmso86qna00b76zp2diwyb3st", "title": "Submission WYB3ST", "payload": {"code": "def f(xs):\n return sum(x<0 for x in xs),sum(x==0 for x in xs),sum(x>0 for x in xs)", "input": "f([-2,0,3,4,0])", "language": "Python", "predicted_output": "(1, 2, 2)"}}
{"submissionId": "cmso86qna00b86zp2eyxxg698", "title": "Submission XXG698", "payload": {"code": "def f(a,b):\n return sorted(set(a)&set(b))", "input": "f([1,2,3,3],[2,3,4])", "language": "Python", "predicted_output": "[2, 3]"}}
{"submissionId": "cmso86qna00b96zp2ri7k951l", "title": "Submission 7K951L", "payload": {"code": "def f(xs,k):\n return [xs[i:i+k] for i in range(0,len(xs),k)]", "input": "f([1,2,3,4,5],2)", "language": "Python", "predicted_output": "[[1, 2], [3, 4], [5]]"}}
{"submissionId": "cmso86qna00ba6zp25nlwkblx", "title": "Submission LWKBLX", "payload": {"code": "def f(d):\n return sum(v for k,v in d.items() if k.startswith('x'))", "input": "f({'x1':3,'y':8,'x2':4})", "language": "Python", "predicted_output": "7"}}
{"submissionId": "cmso86qna00bb6zp2czvyle8c", "title": "Submission VYLE8C", "payload": {"code": "def f(s):\n return s == s[::-1]", "input": "(f('level'),f('levels'))", "language": "Python", "predicted_output": "(True, False)"}}
{"submissionId": "cmso86qna00bc6zp2s6gkvemp", "title": "Submission GKVEMP", "payload": {"code": "def f(xs):\n return [b-a for a,b in zip(xs,xs[1:])]", "input": "f([3,8,6,10])", "language": "Python", "predicted_output": "[5, -2, 4]"}}
{"submissionId": "cmsoiw6wv0002ctp2qii51bdk", "title": "Submission I51BDK", "payload": {"code": "def word_freq(text):\n freq = {}\n for w in text.split():\n freq[w] = freq.get(w, 0) + 1\n return sorted(freq.items())", "input": "word_freq('a b a c b a')", "language": "Python", "predicted_output": "[('a', 3), ('b', 2), ('c', 1)]"}}
{"submissionId": "cmsoiw6wv0003ctp2zexklme7", "title": "Submission XKLME7", "payload": {"code": "class Stack:\n def __init__(self):\n self.data = []\n def push(self, x):\n self.data.append(x)\n def pop(self):\n return self.data.pop()\n def peek(self):\n return self.data[-1]\n\ndef stack_ops():\n s = Stack()\n s.push(1)\n s.push(2)\n s.push(3)\n s.pop()\n s.push(5)\n return (s.peek(), len(s.data))", "input": "stack_ops()", "language": "Python", "predicted_output": "(5, 3)"}}
{"submissionId": "cmsoiw6wv0004ctp2137s2ov4", "title": "Submission 7S2OV4", "payload": {"code": "def merge_intervals(intervals):\n intervals = sorted(intervals)\n merged = []\n for start, end in intervals:\n if merged and start <= merged[-1][1]:\n merged[-1] = (merged[-1][0], max(merged[-1][1], end))\n else:\n merged.append((start, end))\n return merged", "input": "merge_intervals([(1,3),(2,6),(8,10),(15,18)])", "language": "Python", "predicted_output": "[(1, 6), (8, 10), (15, 18)]"}}
{"submissionId": "cmsoiw6wv0006ctp21ozcdeu6", "title": "Submission ZCDEU6", "payload": {"code": "def flatten(nested):\n result = []\n for item in nested:\n if isinstance(item, list):\n result.extend(flatten(item))\n else:\n result.append(item)\n return result", "input": "flatten([1, [2, 3, [4, 5]], 6, [7]])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7]"}}
{"submissionId": "cmsoiw6wv0007ctp2yoqjb9a9", "title": "Submission QJB9A9", "payload": {"code": "def char_count_map(s):\n from collections import Counter\n c = Counter(s)\n return dict(sorted(c.items()))", "input": "char_count_map('mississippi')", "language": "Python", "predicted_output": "{'i': 4, 'm': 1, 'p': 2, 's': 4}"}}
{"submissionId": "cmsoiw6wv0008ctp2a4c6cx15", "title": "Submission C6CX15", "payload": {"code": "def rotate_list(lst, k):\n if not lst:\n return lst\n k = k % len(lst)\n return lst[-k:] + lst[:-k]", "input": "rotate_list([1,2,3,4,5], 2)", "language": "Python", "predicted_output": "[4, 5, 1, 2, 3]"}}
{"submissionId": "cmsoiw6wv0009ctp2ipjsuyvx", "title": "Submission JSUYVX", "payload": {"code": "def is_balanced(s):\n stack = []\n pairs = {')':'(', ']':'[', '}':'{'}\n for ch in s:\n if ch in '([{':\n stack.append(ch)\n elif ch in ')]}':\n if not stack or stack.pop() != pairs[ch]:\n return False\n return not stack", "input": "is_balanced('([{}])')", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsoiw6ww000actp2ew30hct5", "title": "Submission 30HCT5", "payload": {"code": "def gen_squares(n):\n def sq():\n for i in range(n):\n yield i * i\n return list(sq())", "input": "gen_squares(6)", "language": "Python", "predicted_output": "[0, 1, 4, 9, 16, 25]"}}
{"submissionId": "cmsoiw6ww000bctp2xn6m0ifa", "title": "Submission 6M0IFA", "payload": {"code": "def try_finally_demo():\n log = []\n try:\n log.append('try')\n raise ValueError('boom')\n except ValueError as e:\n log.append(f'except:{e}')\n finally:\n log.append('finally')\n return log", "input": "try_finally_demo()", "language": "Python", "predicted_output": "['try', 'except:boom', 'finally']"}}
{"submissionId": "cmsoiw6ww000cctp22nmb1dqv", "title": "Submission MB1DQV", "payload": {"code": "def matrix_transpose(m):\n return [list(row) for row in zip(*m)]", "input": "matrix_transpose([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "[[1, 4], [2, 5], [3, 6]]"}}
{"submissionId": "cmsoiw6ww000dctp286q9j66z", "title": "Submission Q9J66Z", "payload": {"code": "def binary_search(arr, target):\n lo, hi = 0, len(arr) - 1\n while lo <= hi:\n mid = (lo + hi) // 2\n if arr[mid] == target:\n return mid\n elif arr[mid] < target:\n lo = mid + 1\n else:\n hi = mid - 1\n return -1", "input": "binary_search([1,3,5,7,9,11], 7)", "language": "Python", "predicted_output": "3"}}
{"submissionId": "cmsoiw6ww000ectp21o6izba3", "title": "Submission 6IZBA3", "payload": {"code": "def default_dict_demo():\n from collections import defaultdict\n d = defaultdict(list)\n for k, v in [('a',1),('b',2),('a',3)]:\n d[k].append(v)\n return dict(d)", "input": "default_dict_demo()", "language": "Python", "predicted_output": "{'a': [1, 3], 'b': [2]}"}}
{"submissionId": "cmsoiw6ww000fctp2s7vmficn", "title": "Submission VMFICN", "payload": {"code": "def slice_tricks(s):\n return (s[::-1], s[1:-1], s[::2])", "input": "slice_tricks('abcdefgh')", "language": "Python", "predicted_output": "('hgfedcba', 'bcdefg', 'aceg')"}}
{"submissionId": "cmsoiw6ww000gctp2bmubxfi2", "title": "Submission UBXFI2", "payload": {"code": "def sum_with_default_arg(lst, acc=None):\n if acc is None:\n acc = []\n acc.append(sum(lst))\n return acc", "input": "sum_with_default_arg([1,2,3])", "language": "Python", "predicted_output": "[6]"}}
{"submissionId": "cmsoiw6ww000hctp291s78r9t", "title": "Submission S78R9T", "payload": {"code": "def zip_longest_demo():\n from itertools import zip_longest\n return list(zip_longest([1,2,3], ['a','b'], fillvalue='X'))", "input": "zip_longest_demo()", "language": "Python", "predicted_output": "[(1, 'a'), (2, 'b'), (3, 'X')]"}}
{"submissionId": "cmsoiw6ww000ictp2yf6ejk23", "title": "Submission 6EJK23", "payload": {"code": "def recursive_factorial(n):\n if n <= 1:\n return 1\n return n * recursive_factorial(n - 1)", "input": "recursive_factorial(6)", "language": "Python", "predicted_output": "720"}}
{"submissionId": "cmsoiw6ww000jctp29v8o8zs4", "title": "Submission 8O8ZS4", "payload": {"code": "def set_ops(a, b):\n sa, sb = set(a), set(b)\n return (sorted(sa & sb), sorted(sa | sb), sorted(sa - sb))", "input": "set_ops([1,2,3,4], [3,4,5,6])", "language": "Python", "predicted_output": "([3, 4], [1, 2, 3, 4, 5, 6], [1, 2])"}}
{"submissionId": "cmsoiw6ww000lctp2yyz7kppt", "title": "Submission Z7KPPT", "payload": {"code": "def enumerate_demo(items):\n return [f'{i}:{v}' for i, v in enumerate(items, start=1)]", "input": "enumerate_demo(['x','y','z'])", "language": "Python", "predicted_output": "['1:x', '2:y', '3:z']"}}
{"submissionId": "cmsoiw6ww000mctp2lcd1lk4l", "title": "Submission D1LK4L", "payload": {"code": "def list_comp_nested():\n return [[i*j for j in range(3)] for i in range(3)]", "input": "list_comp_nested()", "language": "Python", "predicted_output": "[[0, 0, 0], [0, 1, 2], [0, 2, 4]]"}}
{"submissionId": "cmsoiw6ww000octp2dhb2q6zr", "title": "Submission B2Q6ZR", "payload": {"code": "def tuple_unpack_star(items):\n first, *middle, last = items\n return (first, middle, last)", "input": "tuple_unpack_star([1,2,3,4,5])", "language": "Python", "predicted_output": "(1, [2, 3, 4], 5)"}}
{"submissionId": "cmsoiw6ww000pctp2wuql4cqi", "title": "Submission QL4CQI", "payload": {"code": "def while_else_demo(n):\n i = 2\n while i < n:\n if n % i == 0:\n return False\n i += 1\n else:\n return True", "input": "while_else_demo(17)", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsoiw6ww000qctp2kqonlklt", "title": "Submission ONLKLT", "payload": {"code": "def sorted_with_key(items):\n return sorted(items, key=lambda x: (-x[1], x[0]))", "input": "sorted_with_key([('a',2),('b',3),('c',2)])", "language": "Python", "predicted_output": "[('b', 3), ('a', 2), ('c', 2)]"}}
{"submissionId": "cmsoiw6ww000rctp2yfttzt5s", "title": "Submission TTZT5S", "payload": {"code": "def nested_dict_update():\n d = {'a': {'x': 1}, 'b': {'y': 2}}\n d['a']['z'] = 99\n d.setdefault('c', {})['w'] = 5\n return d", "input": "nested_dict_update()", "language": "Python", "predicted_output": "{'a': {'x': 1, 'z': 99}, 'b': {'y': 2}, 'c': {'w': 5}}"}}
{"submissionId": "cmsoiw6ww000sctp23xzfrw36", "title": "Submission ZFRW36", "payload": {"code": "def chained_comparison(a, b, c):\n return a < b < c", "input": "chained_comparison(1, 5, 10)", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsoiw6ww000tctp23q7zs99g", "title": "Submission 7ZS99G", "payload": {"code": "def bytes_ops():\n b = bytes([104, 101, 108, 108, 111])\n return (b, b.decode(), len(b))", "input": "bytes_ops()", "language": "Python", "predicted_output": "(b'hello', 'hello', 5)"}}
{"submissionId": "cmspwitjl000f7vp2s4nxh626", "title": "Submission NXH626", "payload": {"code": "def fib_seq(n):\n cache = {0: 0, 1: 1}\n for i in range(2, n + 1):\n cache[i] = cache[i - 1] + cache[i - 2]\n return [cache[i] for i in range(n + 1)]", "input": "fib_seq(7)", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8, 13]"}}
{"submissionId": "cmspwitjl000g7vp2wwlc5kvb", "title": "Submission LC5KVB", "payload": {"code": "class ValidationError(Exception):\n pass\n\ndef validate_age(age):\n try:\n if age < 0:\n raise ValidationError(\"negative age\")\n return age * 2\n except ValidationError as e:\n return f\"error: {e}\"", "input": "(validate_age(5), validate_age(-3))", "language": "Python", "predicted_output": "(10, 'error: negative age')"}}
{"submissionId": "cmspwitjl000h7vp2g6rrkp6v", "title": "Submission RRKP6V", "payload": {"code": "def compare_sets(a, b):\n return {\n \"union\": sorted(a | b),\n \"intersection\": sorted(a & b),\n \"difference\": sorted(a - b)\n }", "input": "compare_sets({1, 2, 3, 4}, {3, 4, 5})", "language": "Python", "predicted_output": "{'union': [1, 2, 3, 4, 5], 'intersection': [3, 4], 'difference': [1, 2]}"}}
{"submissionId": "cmspwitjl000j7vp23qk98jyo", "title": "Submission K98JYO", "payload": {"code": "def top_scores(records, n):\n return sorted(records, key=lambda r: (-r[1], r[0]))[:n]", "input": "top_scores([(\"alice\", 90), (\"bob\", 95), (\"carol\", 90), (\"dave\", 95)], 3)", "language": "Python", "predicted_output": "[('bob', 95), ('dave', 95), ('alice', 90)]"}}
{"submissionId": "cmspwitjl000k7vp2odtofi47", "title": "Submission TOFI47", "payload": {"code": "def even_squares(nums):\n for n in nums:\n if n % 2 == 0:\n yield n * n\n\ndef sum_even_squares(nums):\n return sum(even_squares(nums))", "input": "sum_even_squares([1, 2, 3, 4, 5, 6])", "language": "Python", "predicted_output": "56"}}
{"submissionId": "cmspwitjl000l7vp22s6oyzqf", "title": "Submission 6OYZQF", "payload": {"code": "def safe_factorial(n):\n if n < 0:\n raise ValueError(\"n must be non-negative\")\n if n == 0:\n return 1\n return n * safe_factorial(n - 1)\n\ndef try_factorial(n):\n try:\n return safe_factorial(n)\n except ValueError as e:\n return str(e)", "input": "(try_factorial(5), try_factorial(-2))", "language": "Python", "predicted_output": "(120, 'n must be non-negative')"}}
{"submissionId": "cmspwitjl000m7vp2rr3l0mcu", "title": "Submission 3L0MCU", "payload": {"code": "def index_map(items):\n return {item: idx for idx, item in enumerate(items) if len(item) > 2}", "input": "index_map([\"a\", \"cat\", \"dog\", \"it\", \"fish\"])", "language": "Python", "predicted_output": "{'cat': 1, 'dog': 2, 'fish': 4}"}}
{"submissionId": "cmspwitjl000n7vp224dpj4xk", "title": "Submission DPJ4XK", "payload": {"code": "def divide_safe(a, b):\n try:\n result = a / b\n except ZeroDivisionError:\n return \"cannot divide by zero\"\n except TypeError:\n return \"invalid types\"\n else:\n return round(result, 2)", "input": "(divide_safe(10, 4), divide_safe(5, 0), divide_safe(5, \"x\"))", "language": "Python", "predicted_output": "(2.5, 'cannot divide by zero', 'invalid types')"}}
{"submissionId": "cmspwitjm000o7vp23dxlwsjg", "title": "Submission XLWSJG", "payload": {"code": "def group_by_parity(nums):\n groups = {\"even\": [], \"odd\": []}\n for n in nums:\n key = \"even\" if n % 2 == 0 else \"odd\"\n groups[key].append(n)\n return groups", "input": "group_by_parity([5, 8, 3, 12, 7, 2])", "language": "Python", "predicted_output": "{'even': [8, 12, 2], 'odd': [5, 3, 7]}"}}
{"submissionId": "cmsrbjijs001ze0p2jrqfx2y6", "title": "Submission QFX2Y6", "payload": {"code": "def fib(n, memo=None):\n if memo is None:\n memo = {}\n if n <= 1:\n return n\n if n not in memo:\n memo[n] = fib(n - 1, memo) + fib(n - 2, memo)\n return memo[n]", "input": "fib(10)", "language": "Python", "predicted_output": "55"}}
{"submissionId": "cmsrbjijs0020e0p21tx642mr", "title": "Submission X642MR", "payload": {"code": "def binary_search(arr, target):\n lo, hi = 0, len(arr) - 1\n while lo <= hi:\n mid = (lo + hi) // 2\n if arr[mid] == target:\n return mid\n elif arr[mid] < target:\n lo = mid + 1\n else:\n hi = mid - 1\n return -1", "input": "binary_search([2, 5, 8, 12, 16, 23, 38, 56, 72, 91], 23)", "language": "Python", "predicted_output": "5"}}
{"submissionId": "cmsrbjijs0021e0p22mfpiqi0", "title": "Submission FPIQI0", "payload": {"code": "def transpose(matrix):\n return [list(row) for row in zip(*matrix)]", "input": "transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]])", "language": "Python", "predicted_output": "[[1, 4, 7], [2, 5, 8], [3, 6, 9]]"}}
{"submissionId": "cmsrbjijs0022e0p2w1lkfihx", "title": "Submission LKFIHX", "payload": {"code": "def word_frequency(text):\n words = text.lower().split()\n freq = {}\n for word in words:\n freq[word] = freq.get(word, 0) + 1\n return dict(sorted(freq.items()))", "input": "word_frequency(\"to be or not to be that is the question\")", "language": "Python", "predicted_output": "{'be': 2, 'is': 1, 'not': 1, 'or': 1, 'question': 1, 'that': 1, 'the': 1, 'to': 2}"}}
{"submissionId": "cmsrbjijs0023e0p2chvd1n9r", "title": "Submission VD1N9R", "payload": {"code": "def flatten(lst):\n result = []\n for item in lst:\n if isinstance(item, list):\n result.extend(flatten(item))\n else:\n result.append(item)\n return result", "input": "flatten([1, [2, [3, [4, 5]], 6], 7, [8, 9]])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7, 8, 9]"}}
{"submissionId": "cmsrbjijs0024e0p21q7b2w9t", "title": "Submission 7B2W9T", "payload": {"code": "def running_max(values):\n result = []\n current = float('-inf')\n for v in values:\n current = max(current, v)\n result.append(current)\n return result", "input": "running_max([3, 1, 4, 1, 5, 9, 2, 6, 5])", "language": "Python", "predicted_output": "[3, 3, 4, 4, 5, 9, 9, 9, 9]"}}
{"submissionId": "cmsrbjijs0025e0p2xy76025p", "title": "Submission 76025P", "payload": {"code": "def deep_merge(base, override):\n result = dict(base)\n for k, v in override.items():\n if k in result and isinstance(result[k], dict) and isinstance(v, dict):\n result[k] = deep_merge(result[k], v)\n else:\n result[k] = v\n return result", "input": "deep_merge({'a': {'x': 1, 'y': 2}, 'b': 3}, {'a': {'y': 99, 'z': 0}, 'c': 4})", "language": "Python", "predicted_output": "{'a': {'x': 1, 'y': 99, 'z': 0}, 'b': 3, 'c': 4}"}}
{"submissionId": "cmsrbjijs0026e0p2jjnv7qve", "title": "Submission NV7QVE", "payload": {"code": "def count_vowels_consonants(s):\n vowels = set('aeiouAEIOU')\n v_count = sum(1 for c in s if c in vowels)\n c_count = sum(1 for c in s if c.isalpha() and c not in vowels)\n return {'vowels': v_count, 'consonants': c_count}", "input": "count_vowels_consonants(\"Hello World\")", "language": "Python", "predicted_output": "{'vowels': 3, 'consonants': 7}"}}
{"submissionId": "cmsrbjijt0027e0p2xg3dj7hf", "title": "Submission 3DJ7HF", "payload": {"code": "def rotate_list(lst, k):\n if not lst:\n return lst\n n = len(lst)\n k = k % n\n return lst[-k:] + lst[:-k] if k else list(lst)", "input": "rotate_list([1, 2, 3, 4, 5, 6, 7], 3)", "language": "Python", "predicted_output": "[5, 6, 7, 1, 2, 3, 4]"}}
{"submissionId": "cmsrbjijt0028e0p23f6xd9b6", "title": "Submission 6XD9B6", "payload": {"code": "def rle_encode(s):\n if not s:\n return []\n result = []\n count = 1\n for i in range(1, len(s)):\n if s[i] == s[i - 1]:\n count += 1\n else:\n result.append((s[i - 1], count))\n count = 1\n result.append((s[-1], count))\n return result", "input": "rle_encode(\"aaabbccddddee\")", "language": "Python", "predicted_output": "[('a', 3), ('b', 2), ('c', 2), ('d', 4), ('e', 2)]"}}
{"submissionId": "cmsrbjijt0029e0p2pggsig1c", "title": "Submission GSIG1C", "payload": {"code": "def chunk_list(lst, size):\n return [lst[i:i + size] for i in range(0, len(lst), size)]", "input": "chunk_list([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3)", "language": "Python", "predicted_output": "[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]"}}
{"submissionId": "cmsrbjijt002ae0p2hlzm00gj", "title": "Submission ZM00GJ", "payload": {"code": "def are_anagrams(s1, s2):\n return sorted(s1.lower().replace(' ', '')) == sorted(s2.lower().replace(' ', ''))", "input": "(are_anagrams(\"listen\", \"silent\"), are_anagrams(\"hello\", \"world\"))", "language": "Python", "predicted_output": "(True, False)"}}
{"submissionId": "cmsrbjijt002be0p24nrygwj9", "title": "Submission RYGWJ9", "payload": {"code": "def prime_factors(n):\n factors = []\n d = 2\n while d * d <= n:\n while n % d == 0:\n factors.append(d)\n n //= d\n d += 1\n if n > 1:\n factors.append(n)\n return factors", "input": "prime_factors(360)", "language": "Python", "predicted_output": "[2, 2, 2, 3, 3, 5]"}}
{"submissionId": "cmsrbjijt002ce0p2gajtgfln", "title": "Submission JTGFLN", "payload": {"code": "from collections import OrderedDict\n\nclass LRUCache:\n def __init__(self, capacity):\n self.capacity = capacity\n self.cache = OrderedDict()\n\n def get(self, key):\n if key not in self.cache:\n return -1\n self.cache.move_to_end(key)\n return self.cache[key]\n\n def put(self, key, value):\n if key in self.cache:\n self.cache.move_to_end(key)\n self.cache[key] = value\n if len(self.cache) > self.capacity:\n self.cache.popitem(last=False)\n\ndef simulate_lru(ops):\n cache = LRUCache(3)\n results = []\n for op, *args in ops:\n if op == 'put':\n cache.put(args[0], args[1])\n elif op == 'get':\n results.append(cache.get(args[0]))\n return results", "input": "simulate_lru([('put', 1, 'a'), ('put', 2, 'b'), ('put', 3, 'c'), ('get', 1), ('put', 4, 'd'), ('get', 2), ('get', 1), ('get', 4)])", "language": "Python", "predicted_output": "['a', -1, 'a', 'd']"}}
{"submissionId": "cmsrbjijt002de0p20ts6p8zm", "title": "Submission S6P8ZM", "payload": {"code": "def zip_with_fill(list1, list2, fill=None):\n length = max(len(list1), len(list2))\n result = []\n for i in range(length):\n a = list1[i] if i < len(list1) else fill\n b = list2[i] if i < len(list2) else fill\n result.append((a, b))\n return result", "input": "zip_with_fill([1, 2, 3, 4], ['a', 'b'], fill=0)", "language": "Python", "predicted_output": "[(1, 'a'), (2, 'b'), (3, 0), (4, 0)]"}}
{"submissionId": "cmsrbjijt002ee0p2f5yni7f2", "title": "Submission YNI7F2", "payload": {"code": "def cumsum_until(values, threshold):\n total = 0\n result = []\n for v in values:\n total += v\n result.append(total)\n if total >= threshold:\n break\n return result", "input": "cumsum_until([5, 3, 8, 2, 7, 4], 20)", "language": "Python", "predicted_output": "[5, 8, 16, 18, 25]"}}
{"submissionId": "cmsrbjijt002ge0p2bo2wdgr5", "title": "Submission 2WDGR5", "payload": {"code": "def merge_sorted(arr1, arr2):\n result = []\n i = j = 0\n while i < len(arr1) and j < len(arr2):\n if arr1[i] <= arr2[j]:\n result.append(arr1[i])\n i += 1\n else:\n result.append(arr2[j])\n j += 1\n result.extend(arr1[i:])\n result.extend(arr2[j:])\n return result", "input": "merge_sorted([1, 4, 6, 8, 10], [2, 3, 5, 7, 9, 11])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]"}}
{"submissionId": "cmsrbjijt002he0p22hij72ds", "title": "Submission IJ72DS", "payload": {"code": "def group_by(items, key_fn):\n groups = {}\n for item in items:\n k = key_fn(item)\n groups.setdefault(k, []).append(item)\n return groups", "input": "group_by([1, 2, 3, 4, 5, 6, 7, 8, 9], lambda x: 'even' if x % 2 == 0 else 'odd')", "language": "Python", "predicted_output": "{'odd': [1, 3, 5, 7, 9], 'even': [2, 4, 6, 8]}"}}
{"submissionId": "cmsrbjijt002ie0p2ploixy71", "title": "Submission OIXY71", "payload": {"code": "def is_balanced(s):\n stack = []\n pairs = {')': '(', ']': '[', '}': '{'}\n for char in s:\n if char in '([{':\n stack.append(char)\n elif char in ')]}' :\n if not stack or stack[-1] != pairs[char]:\n return False\n stack.pop()\n return len(stack) == 0", "input": "(is_balanced(\"({[a+b]*c}-d)\"), is_balanced(\"([)]\"), is_balanced(\"(()\"))", "language": "Python", "predicted_output": "(True, False, False)"}}
{"submissionId": "cmsrfjbt40023y8p2zp9ryms4", "title": "Submission 9RYMS4", "payload": {"code": "def segment_sums(values):\n out=[]\n cur=0\n for x in values:\n if x is None:\n out.append(cur)\n cur=0\n else:\n cur += x\n out.append(cur)\n return out\n", "input": "segment_sums([2,3,None,-1,4,None,7])", "language": "Python", "predicted_output": "[5, 3, 7]"}}
{"submissionId": "cmsrfjbt40024y8p20wzabymf", "title": "Submission ZABYMF", "payload": {"code": "def rotate_map(pairs, k):\n d=dict(pairs)\n keys=sorted(d)\n return [(key, d[key] + i*k) for i, key in enumerate(keys)]\n", "input": "rotate_map([('b',2),('a',5),('c',1)],3)", "language": "Python", "predicted_output": "[('a', 5), ('b', 5), ('c', 7)]"}}
{"submissionId": "cmsrfjbt40025y8p2xkup6vgq", "title": "Submission UP6VGQ", "payload": {"code": "from collections import deque\n\ndef bounded_queue(values, limit):\n q=deque()\n dropped=[]\n for x in values:\n q.append(x)\n if len(q)>limit:\n dropped.append(q.popleft())\n return list(q), dropped\n", "input": "bounded_queue([4,1,9,2,8],3)", "language": "Python", "predicted_output": "([9, 2, 8], [4, 1])"}}
{"submissionId": "cmsrfjbt40026y8p2r6rccn9w", "title": "Submission RCCN9W", "payload": {"code": "def parity_fold(nums):\n acc=0\n out=[]\n for i,x in enumerate(nums):\n acc = acc + x if i % 2 == 0 else acc - x\n out.append(acc)\n return out\n", "input": "parity_fold([5,2,7,3])", "language": "Python", "predicted_output": "[5, 3, 10, 7]"}}
{"submissionId": "cmsrfjbt40027y8p2r6jeyxf8", "title": "Submission JEYXF8", "payload": {"code": "def lookup_chain(mapping, keys):\n cur=mapping\n for k in keys:\n try:\n cur=cur[k]\n except (KeyError, TypeError, IndexError):\n return 'missing'\n return cur\n", "input": "lookup_chain({'a':{'b':[10,20]}}, ['a','b',1])", "language": "Python", "predicted_output": "20"}}
{"submissionId": "cmsrg4wst003xy8p2yo6ua2wo", "title": "Submission 6UA2WO", "payload": {"code": "def safe_divide(a, b):\n try:\n return a / b\n except ZeroDivisionError:\n return None", "input": "(safe_divide(10, 2), safe_divide(5, 0))", "language": "Python", "predicted_output": "(5.0, None)"}}
{"submissionId": "cmsrg4wsu003yy8p28085utng", "title": "Submission 85UTNG", "payload": {"code": "def count_chars(s):\n from collections import Counter\n return dict(Counter(s))", "input": "count_chars('banana')", "language": "Python", "predicted_output": "{'b': 1, 'a': 3, 'n': 2}"}}
{"submissionId": "cmsrg4wsu003zy8p2018cqu42", "title": "Submission 8CQU42", "payload": {"code": "class Stack:\n def __init__(self):\n self.items = []\n def push(self, x):\n self.items.append(x)\n def pop(self):\n return self.items.pop()\n\ndef stack_demo():\n s = Stack()\n s.push(1)\n s.push(2)\n s.push(3)\n a = s.pop()\n b = s.pop()\n return (a, b, s.items)", "input": "stack_demo()", "language": "Python", "predicted_output": "(3, 2, [1])"}}
{"submissionId": "cmsrg4wsu0040y8p2c7nvrbmr", "title": "Submission NVRBMR", "payload": {"code": "def fib_gen(n):\n a, b = 0, 1\n result = []\n for _ in range(n):\n result.append(a)\n a, b = b, a+b\n return result", "input": "fib_gen(7)", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8]"}}
{"submissionId": "cmsrg5dm70041y8p2gh9pyzno", "title": "Submission 9PYZNO", "payload": {"code": "def merge_dicts(d1, d2):\n merged = d1.copy()\n merged.update(d2)\n return merged", "input": "merge_dicts({'a': 1, 'b': 2}, {'b': 3, 'c': 4})", "language": "Python", "predicted_output": "{'a': 1, 'b': 3, 'c': 4}"}}
{"submissionId": "cmsrg7uni0043y8p2g4jvoq9l", "title": "Submission JVOQ9L", "payload": {"code": "def try_finally_demo():\n log = []\n try:\n log.append('try')\n raise ValueError('oops')\n except ValueError as e:\n log.append(f'caught: {e}')\n finally:\n log.append('finally')\n return log", "input": "try_finally_demo()", "language": "Python", "predicted_output": "['try', 'caught: oops', 'finally']"}}
{"submissionId": "cmsrg7uni0045y8p2l27dvf1s", "title": "Submission 7DVF1S", "payload": {"code": "def default_mutable(lst=[]):\n lst.append(1)\n return lst", "input": "(default_mutable(), default_mutable())", "language": "Python", "predicted_output": "([1, 1], [1, 1])"}}
{"submissionId": "cmsrg7uni0046y8p2linhpjbb", "title": "Submission NHPJBB", "payload": {"code": "class Counter2:\n def __init__(self):\n self.count = 0\n def __call__(self):\n self.count += 1\n return self.count\n\nc = Counter2()", "input": "(c(), c(), c())", "language": "Python", "predicted_output": "(1, 2, 3)"}}
{"submissionId": "cmsrg7uni0047y8p2aucpcxk1", "title": "Submission CPCXK1", "payload": {"code": "def gen_squares(n):\n for i in range(n):\n yield i*i", "input": "list(gen_squares(5))", "language": "Python", "predicted_output": "[0, 1, 4, 9, 16]"}}
{"submissionId": "cmsrg7uni0048y8p25535s2zc", "title": "Submission 35S2ZC", "payload": {"code": "def zip_sum(a, b):\n return [x+y for x, y in zip(a, b)]", "input": "zip_sum([1,2,3], [10,20,30,40])", "language": "Python", "predicted_output": "[11, 22, 33]"}}
{"submissionId": "cmsrg7uni004by8p20qbeqk5l", "title": "Submission BEQK5L", "payload": {"code": "def recursive_sum(lst):\n if not lst:\n return 0\n return lst[0] + recursive_sum(lst[1:])", "input": "recursive_sum([1,2,3,4,5])", "language": "Python", "predicted_output": "15"}}
{"submissionId": "cmsrg7uni004cy8p2qi6wn2es", "title": "Submission 6WN2ES", "payload": {"code": "def set_operations(a, b):\n return {'union': sorted(a | b), 'intersection': sorted(a & b), 'diff': sorted(a - b)}", "input": "set_operations({1,2,3,4}, {3,4,5,6})", "language": "Python", "predicted_output": "{'union': [1, 2, 3, 4, 5, 6], 'intersection': [3, 4], 'diff': [1, 2]}"}}
{"submissionId": "cmsrg7uni004dy8p26qn2xug8", "title": "Submission N2XUG8", "payload": {"code": "def closure_counter():\n count = 0\n def increment():\n nonlocal count\n count += 1\n return count\n return increment\n\ninc = closure_counter()", "input": "(inc(), inc(), inc())", "language": "Python", "predicted_output": "(1, 2, 3)"}}
{"submissionId": "cmsrg8gp1004ey8p216tavi35", "title": "Submission TAVI35", "payload": {"code": "def slice_demo(s):\n return (s[::2], s[::-1], s[1:4])", "input": "slice_demo('abcdefgh')", "language": "Python", "predicted_output": "('aceg', 'hgfedcba', 'bcd')"}}
{"submissionId": "cmsrg8gp1004fy8p2mri1qcdt", "title": "Submission I1QCDT", "payload": {"code": "import itertools\ndef combo_demo(items, r):\n return list(itertools.combinations(items, r))", "input": "combo_demo([1,2,3], 2)", "language": "Python", "predicted_output": "[(1, 2), (1, 3), (2, 3)]"}}
{"submissionId": "cmsrg8m8m004hy8p2zz9k68uw", "title": "Submission 9K68UW", "payload": {"code": "def multiple_return(x):\n if x > 0:\n return 'positive', x\n elif x < 0:\n return 'negative', -x\n return 'zero', 0", "input": "(multiple_return(5), multiple_return(-3), multiple_return(0))", "language": "Python", "predicted_output": "(('positive', 5), ('negative', 3), ('zero', 0))"}}
{"submissionId": "cmsrg8yka004iy8p25em8b0ah", "title": "Submission M8B0AH", "payload": {"code": "class Animal:\n def speak(self):\n return 'generic sound'\n\nclass Dog(Animal):\n def speak(self):\n return 'woof'\n\ndef animal_demo():\n animals = [Animal(), Dog()]\n return [a.speak() for a in animals]", "input": "animal_demo()", "language": "Python", "predicted_output": "['generic sound', 'woof']"}}
{"submissionId": "cmsrg8yka004ly8p2u05xfuat", "title": "Submission 5XFUAT", "payload": {"code": "def all_any_demo(nums):\n return (all(n > 0 for n in nums), any(n < 0 for n in nums))", "input": "all_any_demo([1, 2, -3, 4])", "language": "Python", "predicted_output": "(False, True)"}}
{"submissionId": "cmsrg8yka004my8p2jdapux77", "title": "Submission APUX77", "payload": {"code": "def string_methods_demo(s):\n return (s.strip().upper(), s.replace('a', 'X'), s.split(','))", "input": "string_methods_demo(' banana,apple,cherry ')", "language": "Python", "predicted_output": "('BANANA,APPLE,CHERRY', ' bXnXnX,Xpple,cherry ', [' banana', 'apple', 'cherry '])"}}
{"submissionId": "cmsrg8yka004ny8p25v3wlpjn", "title": "Submission 3WLPJN", "payload": {"code": "def lambda_sort_demo(pairs):\n return sorted(pairs, key=lambda p: (-p[1], p[0]))", "input": "lambda_sort_demo([('x', 1), ('y', 2), ('z', 1)])", "language": "Python", "predicted_output": "[('y', 2), ('x', 1), ('z', 1)]"}}
{"submissionId": "cmsrg9m71004oy8p21w1j15jr", "title": "Submission 1J15JR", "payload": {"code": "def try_else_demo(x):\n try:\n result = 10 / x\n except ZeroDivisionError:\n return 'error'\n else:\n return round(result, 2)", "input": "(try_else_demo(2), try_else_demo(0))", "language": "Python", "predicted_output": "(5.0, 'error')"}}
{"submissionId": "cmsrg9m71004py8p2rpodfc6u", "title": "Submission ODFC6U", "payload": {"code": "def list_vs_tuple_unpack():\n a, *b, c = [1, 2, 3, 4, 5]\n return (a, b, c)", "input": "list_vs_tuple_unpack()", "language": "Python", "predicted_output": "(1, [2, 3, 4], 5)"}}
{"submissionId": "cmsrg9m71004qy8p20rzuom6z", "title": "Submission ZUOM6Z", "payload": {"code": "def deep_copy_demo():\n import copy\n original = {'a': [1, 2, 3]}\n shallow = original.copy()\n deep = copy.deepcopy(original)\n original['a'].append(4)\n return (shallow, deep)", "input": "deep_copy_demo()", "language": "Python", "predicted_output": "({'a': [1, 2, 3, 4]}, {'a': [1, 2, 3]})"}}
{"submissionId": "cmsrg9m71004ry8p2z7elnvbb", "title": "Submission ELNVBB", "payload": {"code": "class Vector:\n def __init__(self, x, y):\n self.x, self.y = x, y\n def __add__(self, other):\n return Vector(self.x + other.x, self.y + other.y)\n def __repr__(self):\n return f'Vector({self.x}, {self.y})'\n\ndef vector_demo():\n v1, v2 = Vector(1,2), Vector(3,4)\n return v1 + v2", "input": "vector_demo()", "language": "Python", "predicted_output": "Vector(4, 6)"}}
{"submissionId": "cmsrg9m71004sy8p2lwgsugub", "title": "Submission GSUGUB", "payload": {"code": "def flatten_dict(d, prefix=''):\n result = {}\n for k, v in d.items():\n key = f'{prefix}.{k}' if prefix else k\n if isinstance(v, dict):\n result.update(flatten_dict(v, key))\n else:\n result[key] = v\n return result", "input": "flatten_dict({'a': 1, 'b': {'c': 2, 'd': {'e': 3}}})", "language": "Python", "predicted_output": "{'a': 1, 'b.c': 2, 'b.d.e': 3}"}}
{"submissionId": "cmsrg9m71004uy8p2zf0iwevd", "title": "Submission 0IWEVD", "payload": {"code": "def while_break_continue(n):\n result = []\n i = 0\n while i < n:\n i += 1\n if i % 2 == 0:\n continue\n if i > 7:\n break\n result.append(i)\n return result", "input": "while_break_continue(10)", "language": "Python", "predicted_output": "[1, 3, 5, 7]"}}
{"submissionId": "cmsrg9m71004vy8p2zhhmofpv", "title": "Submission HMOFPV", "payload": {"code": "def multi_assignment():\n x = y = z = 5\n x += 1\n return (x, y, z)", "input": "multi_assignment()", "language": "Python", "predicted_output": "(6, 5, 5)"}}
{"submissionId": "cmsrg9m71004xy8p2e2420igy", "title": "Submission 420IGY", "payload": {"code": "def chained_comparison(x):\n return 0 < x < 10", "input": "(chained_comparison(5), chained_comparison(15), chained_comparison(-1))", "language": "Python", "predicted_output": "(True, False, False)"}}
{"submissionId": "cmsrg9m710052y8p2usc5fzhe", "title": "Submission C5FZHE", "payload": {"code": "def none_coalesce(a, b):\n return a if a is not None else b", "input": "(none_coalesce(None, 5), none_coalesce(0, 5), none_coalesce(3, 5))", "language": "Python", "predicted_output": "(5, 0, 3)"}}
{"submissionId": "cmsrg9m720053y8p2hmeho25y", "title": "Submission EHO25Y", "payload": {"code": "def matrix_transpose(m):\n return list(zip(*m))", "input": "matrix_transpose([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "[(1, 4), (2, 5), (3, 6)]"}}
{"submissionId": "cmsrg9m720057y8p2n5vw3bcj", "title": "Submission VW3BCJ", "payload": {"code": "def negative_indexing(lst):\n return (lst[-1], lst[-2], lst[-len(lst)])", "input": "negative_indexing([10,20,30,40,50])", "language": "Python", "predicted_output": "(50, 40, 10)"}}
{"submissionId": "cmsrg9m720058y8p27saqul7r", "title": "Submission AQUL7R", "payload": {"code": "def dict_ordering():\n d = {}\n d['z'] = 1\n d['a'] = 2\n d['m'] = 3\n return list(d.keys())", "input": "dict_ordering()", "language": "Python", "predicted_output": "['z', 'a', 'm']"}}
{"submissionId": "cmsrh0ira006yy8p2ue0o1c0t", "title": "Submission 0O1C0T", "payload": {"code": "def window_sums(values, size):\n return [sum(values[i:i+size]) for i in range(len(values)-size+1)]", "input": "window_sums([3, -1, 4, 2, 5], 3)", "language": "Python", "predicted_output": "[6, 5, 11]"}}
{"submissionId": "cmsrh0ira006zy8p2fisa3the", "title": "Submission SA3THE", "payload": {"code": "def window_sums(values, size):\n return [sum(values[i:i+size]) for i in range(len(values)-size+1)]", "input": "window_sums([10, 0, -2, 7], 2)", "language": "Python", "predicted_output": "[10, -2, 5]"}}
{"submissionId": "cmsrh0ira0070y8p2e0cka3t8", "title": "Submission CKA3T8", "payload": {"code": "def alternating_total(values):\n return sum(v if i % 2 == 0 else -v for i, v in enumerate(values))", "input": "alternating_total([8, 3, 5, 2])", "language": "Python", "predicted_output": "8"}}
{"submissionId": "cmsrh0ira0071y8p2xm72loa3", "title": "Submission 72LOA3", "payload": {"code": "def alternating_total(values):\n return sum(v if i % 2 == 0 else -v for i, v in enumerate(values))", "input": "alternating_total([1, 9, 2, 8, 3])", "language": "Python", "predicted_output": "-11"}}
{"submissionId": "cmsrh0ira0072y8p27dh1pd1u", "title": "Submission H1PD1U", "payload": {"code": "def prefix_minima(values):\n out=[]\n cur=float('inf')\n for v in values:\n cur=min(cur,v); out.append(cur)\n return out", "input": "prefix_minima([7, 4, 9, 2, 6])", "language": "Python", "predicted_output": "[7, 4, 4, 2, 2]"}}
{"submissionId": "cmsrh0ira0073y8p2ur4g0e1k", "title": "Submission 4G0E1K", "payload": {"code": "def prefix_minima(values):\n out=[]\n cur=float('inf')\n for v in values:\n cur=min(cur,v); out.append(cur)\n return out", "input": "prefix_minima([0, -1, 3, -5, 2])", "language": "Python", "predicted_output": "[0, -1, -1, -5, -5]"}}
{"submissionId": "cmsrh0ira0074y8p28tbrw2q9", "title": "Submission BRW2Q9", "payload": {"code": "def bounded_product(values, cap):\n total=1\n for v in values:\n total*=v\n if total>cap: return cap\n return total", "input": "bounded_product([2, 3, 5], 20)", "language": "Python", "predicted_output": "20"}}
{"submissionId": "cmsrh0ira0075y8p2azk2uw8v", "title": "Submission K2UW8V", "payload": {"code": "def bounded_product(values, cap):\n total=1\n for v in values:\n total*=v\n if total>cap: return cap\n return total", "input": "bounded_product([2, 3, 2], 20)", "language": "Python", "predicted_output": "12"}}
{"submissionId": "cmsrh0ira0076y8p2qn2o8osr", "title": "Submission 2O8OSR", "payload": {"code": "def difference_chain(values):\n rows=[values]\n while len(rows[-1])>1:\n prev=rows[-1]; rows.append([b-a for a,b in zip(prev,prev[1:])])\n return rows", "input": "difference_chain([2, 5, 11, 20])", "language": "Python", "predicted_output": "[[2, 5, 11, 20], [3, 6, 9], [3, 3], [0]]"}}
{"submissionId": "cmsrh0ira0077y8p2oaqbs5bc", "title": "Submission QBS5BC", "payload": {"code": "def difference_chain(values):\n rows=[values]\n while len(rows[-1])>1:\n prev=rows[-1]; rows.append([b-a for a,b in zip(prev,prev[1:])])\n return rows", "input": "difference_chain([1, 4, 9, 16])", "language": "Python", "predicted_output": "[[1, 4, 9, 16], [3, 5, 7], [2, 2], [0]]"}}
{"submissionId": "cmsrh0ira0078y8p2rvl8xi8h", "title": "Submission L8XI8H", "payload": {"code": "def rotate_blocks(values, size):\n out=[]\n for i in range(0,len(values),size):\n block=values[i:i+size]\n out.extend(block[1:]+block[:1])\n return out", "input": "rotate_blocks([1, 2, 3, 4, 5, 6, 7], 3)", "language": "Python", "predicted_output": "[2, 3, 1, 5, 6, 4, 7]"}}
{"submissionId": "cmsrh0ira0079y8p2u2uyrxrf", "title": "Submission UYRXRF", "payload": {"code": "def rotate_blocks(values, size):\n out=[]\n for i in range(0,len(values),size):\n block=values[i:i+size]\n out.extend(block[1:]+block[:1])\n return out", "input": "rotate_blocks([9, 8, 7, 6, 5], 2)", "language": "Python", "predicted_output": "[8, 9, 6, 7, 5]"}}
{"submissionId": "cmsrh0ira007ay8p2gfci6v3s", "title": "Submission CI6V3S", "payload": {"code": "def count_transitions(values):\n return sum(a != b for a,b in zip(values,values[1:]))", "input": "count_transitions([1, 1, 2, 2, 3, 1])", "language": "Python", "predicted_output": "3"}}
{"submissionId": "cmsrh0ira007by8p2zrqj9gzj", "title": "Submission QJ9GZJ", "payload": {"code": "def count_transitions(values):\n return sum(a != b for a,b in zip(values,values[1:]))", "input": "count_transitions([5, 5, 5, 5])", "language": "Python", "predicted_output": "0"}}
{"submissionId": "cmsrh0ira007cy8p2w3hnwz7m", "title": "Submission HNWZ7M", "payload": {"code": "def zigzag_merge(left, right):\n out=[]\n for i in range(max(len(left),len(right))):\n if i<len(left): out.append(left[i])\n if i<len(right): out.append(right[-1-i])\n return out", "input": "zigzag_merge([1, 2, 3], [7, 8, 9, 10])", "language": "Python", "predicted_output": "[1, 10, 2, 9, 3, 8, 7]"}}
{"submissionId": "cmsrh0irb007dy8p2swlfu0i2", "title": "Submission LFU0I2", "payload": {"code": "def zigzag_merge(left, right):\n out=[]\n for i in range(max(len(left),len(right))):\n if i<len(left): out.append(left[i])\n if i<len(right): out.append(right[-1-i])\n return out", "input": "zigzag_merge([4, 5], [1, 2])", "language": "Python", "predicted_output": "[4, 2, 5, 1]"}}
{"submissionId": "cmsrh0irb007ey8p2q6vslrus", "title": "Submission VSLRUS", "payload": {"code": "def rank_values(values):\n order={v:i+1 for i,v in enumerate(sorted(set(values)))}\n return [order[v] for v in values]", "input": "rank_values([40, 10, 20, 10])", "language": "Python", "predicted_output": "[3, 1, 2, 1]"}}
{"submissionId": "cmsrh0irb007fy8p2tgcudf40", "title": "Submission CUDF40", "payload": {"code": "def rank_values(values):\n order={v:i+1 for i,v in enumerate(sorted(set(values)))}\n return [order[v] for v in values]", "input": "rank_values([3, -1, 3, 7, 0])", "language": "Python", "predicted_output": "[3, 1, 3, 4, 2]"}}
{"submissionId": "cmsrh0irb007gy8p237joknta", "title": "Submission JOKNTA", "payload": {"code": "def clamped_deltas(values, limit):\n return [max(-limit,min(limit,b-a)) for a,b in zip(values,values[1:])]", "input": "clamped_deltas([2, 10, 7, 20], 5)", "language": "Python", "predicted_output": "[5, -3, 5]"}}
{"submissionId": "cmsrh0irb007hy8p2vo0hxq2e", "title": "Submission 0HXQ2E", "payload": {"code": "def clamped_deltas(values, limit):\n return [max(-limit,min(limit,b-a)) for a,b in zip(values,values[1:])]", "input": "clamped_deltas([0, -9, -8, 4], 3)", "language": "Python", "predicted_output": "[-3, 1, 3]"}}
{"submissionId": "cmsrh0irb007iy8p2avuq2cud", "title": "Submission UQ2CUD", "payload": {"code": "def pair_products(values):\n return [values[i]*values[-1-i] for i in range((len(values)+1)//2)]", "input": "pair_products([2, 3, 4, 5])", "language": "Python", "predicted_output": "[10, 12]"}}
{"submissionId": "cmsrh0irb007jy8p2yvj5e5l8", "title": "Submission J5E5L8", "payload": {"code": "def pair_products(values):\n return [values[i]*values[-1-i] for i in range((len(values)+1)//2)]", "input": "pair_products([1, -2, 3, -4, 5])", "language": "Python", "predicted_output": "[5, 8, 9]"}}
{"submissionId": "cmsrh0irb007ky8p26yzmg5q4", "title": "Submission ZMG5Q4", "payload": {"code": "def running_mod(values, modulus):\n total=0; out=[]\n for v in values:\n total=(total+v)%modulus; out.append(total)\n return out", "input": "running_mod([7, 8, 9, 10], 6)", "language": "Python", "predicted_output": "[1, 3, 0, 4]"}}
{"submissionId": "cmsrh0irb007ly8p23qizndaa", "title": "Submission IZNDAA", "payload": {"code": "def running_mod(values, modulus):\n total=0; out=[]\n for v in values:\n total=(total+v)%modulus; out.append(total)\n return out", "input": "running_mod([5, -3, 11], 7)", "language": "Python", "predicted_output": "[5, 2, 6]"}}
{"submissionId": "cmsrh0irb007my8p2ojvpe7z5", "title": "Submission VPE7Z5", "payload": {"code": "def collapse_runs(values):\n out=[]\n for v in values:\n if not out or out[-1]!=v: out.append(v)\n return out", "input": "collapse_runs([1, 1, 2, 2, 2, 3, 1, 1])", "language": "Python", "predicted_output": "[1, 2, 3, 1]"}}
{"submissionId": "cmsrh0irb007ny8p2vz7lc94h", "title": "Submission 7LC94H", "payload": {"code": "def collapse_runs(values):\n out=[]\n for v in values:\n if not out or out[-1]!=v: out.append(v)\n return out", "input": "collapse_runs([4, 4, 4, 2, 4])", "language": "Python", "predicted_output": "[4, 2, 4]"}}
{"submissionId": "cmsrh0irb007oy8p28cp1yv48", "title": "Submission P1YV48", "payload": {"code": "def weighted_index(values):\n return sum((i+1)*v for i,v in enumerate(values))", "input": "weighted_index([3, 1, 4, 1])", "language": "Python", "predicted_output": "21"}}
{"submissionId": "cmsrh0irb007py8p2z6jobb6t", "title": "Submission JOBB6T", "payload": {"code": "def weighted_index(values):\n return sum((i+1)*v for i,v in enumerate(values))", "input": "weighted_index([2, -1, 5])", "language": "Python", "predicted_output": "15"}}
{"submissionId": "cmsrh0irb007qy8p2vtblkhdh", "title": "Submission BLKHDH", "payload": {"code": "def mirror_sum(values):\n return [a+b for a,b in zip(values,reversed(values))]", "input": "mirror_sum([1, 2, 3, 4])", "language": "Python", "predicted_output": "[5, 5, 5, 5]"}}
{"submissionId": "cmsrh0irb007ry8p2f438nggp", "title": "Submission 38NGGP", "payload": {"code": "def mirror_sum(values):\n return [a+b for a,b in zip(values,reversed(values))]", "input": "mirror_sum([5, -1, 0])", "language": "Python", "predicted_output": "[5, -2, 5]"}}
{"submissionId": "cmsrh0irb007sy8p2y72alqu5", "title": "Submission 2ALQU5", "payload": {"code": "def threshold_groups(values, threshold):\n low=[v for v in values if v<threshold]\n high=[v for v in values if v>=threshold]\n return [low,high]", "input": "threshold_groups([8, 2, 7, 1, 9], 7)", "language": "Python", "predicted_output": "[[2, 1], [8, 7, 9]]"}}
{"submissionId": "cmsrh0irb007ty8p2pggu1z24", "title": "Submission GU1Z24", "payload": {"code": "def threshold_groups(values, threshold):\n low=[v for v in values if v<threshold]\n high=[v for v in values if v>=threshold]\n return [low,high]", "input": "threshold_groups([0, -3, 4, 2], 1)", "language": "Python", "predicted_output": "[[0, -3], [4, 2]]"}}
{"submissionId": "cmsrh0irb007uy8p2x9dmda5k", "title": "Submission DMDA5K", "payload": {"code": "def circular_differences(values):\n return [values[(i+1)%len(values)]-v for i,v in enumerate(values)]", "input": "circular_differences([2, 5, 9])", "language": "Python", "predicted_output": "[3, 4, -7]"}}
{"submissionId": "cmsrh0irb007vy8p2qysol362", "title": "Submission SOL362", "payload": {"code": "def circular_differences(values):\n return [values[(i+1)%len(values)]-v for i,v in enumerate(values)]", "input": "circular_differences([10, 7, 7, 1])", "language": "Python", "predicted_output": "[-3, 0, -6, 9]"}}
{"submissionId": "cmsrh0irb007wy8p2ejpsimh6", "title": "Submission PSIMH6", "payload": {"code": "def take_until_repeat(values):\n seen=set(); out=[]\n for v in values:\n if v in seen: break\n seen.add(v); out.append(v)\n return out", "input": "take_until_repeat([3, 1, 4, 1, 5])", "language": "Python", "predicted_output": "[3, 1, 4]"}}
{"submissionId": "cmsrh0irb007xy8p2mmxsf0yf", "title": "Submission XSF0YF", "payload": {"code": "def take_until_repeat(values):\n seen=set(); out=[]\n for v in values:\n if v in seen: break\n seen.add(v); out.append(v)\n return out", "input": "take_until_repeat([2, 7, 9, 2])", "language": "Python", "predicted_output": "[2, 7, 9]"}}
{"submissionId": "cmsrh0irb007yy8p2i50oegnp", "title": "Submission 0OEGNP", "payload": {"code": "def staircase_fill(start, steps):\n out=[]; value=start\n for step in steps:\n value+=step; out.append(value)\n return out", "input": "staircase_fill(10, [1, 2, -3, 4])", "language": "Python", "predicted_output": "[11, 13, 10, 14]"}}
{"submissionId": "cmsrh0irb007zy8p24vmuhwit", "title": "Submission MUHWIT", "payload": {"code": "def staircase_fill(start, steps):\n out=[]; value=start\n for step in steps:\n value+=step; out.append(value)\n return out", "input": "staircase_fill(0, [5, -2, -2, 1])", "language": "Python", "predicted_output": "[5, 3, 1, 2]"}}
{"submissionId": "cmsrh0irb0080y8p25vqmwvbc", "title": "Submission QMWVBC", "payload": {"code": "def odd_even_balance(values):\n return sum(v for v in values if v%2)-sum(v for v in values if v%2==0)", "input": "odd_even_balance([1, 2, 3, 4, 5])", "language": "Python", "predicted_output": "3"}}
{"submissionId": "cmsrh0irb0081y8p2bii3i3wi", "title": "Submission I3I3WI", "payload": {"code": "def odd_even_balance(values):\n return sum(v for v in values if v%2)-sum(v for v in values if v%2==0)", "input": "odd_even_balance([6, 7, 8, 9])", "language": "Python", "predicted_output": "2"}}
{"submissionId": "cmsrh0irb0082y8p2c133kyls", "title": "Submission 33KYLS", "payload": {"code": "def bounded_gaps(values, bound):\n return [abs(b-a)<=bound for a,b in zip(values,values[1:])]", "input": "bounded_gaps([1, 4, 8, 10], 3)", "language": "Python", "predicted_output": "[True, False, True]"}}
{"submissionId": "cmsrh0irb0083y8p2u7creluo", "title": "Submission CRELUO", "payload": {"code": "def bounded_gaps(values, bound):\n return [abs(b-a)<=bound for a,b in zip(values,values[1:])]", "input": "bounded_gaps([5, 1, 0, 7], 4)", "language": "Python", "predicted_output": "[True, True, False]"}}
{"submissionId": "cmsrh0irb0084y8p2gw6cg11i", "title": "Submission 6CG11I", "payload": {"code": "def segment_totals(values, marker):\n out=[]; total=0\n for v in values:\n if v==marker: out.append(total); total=0\n else: total+=v\n out.append(total)\n return out", "input": "segment_totals([2, 3, 0, 4, 0, 5, 1], 0)", "language": "Python", "predicted_output": "[5, 4, 6]"}}
{"submissionId": "cmsrh0irb0085y8p22078tuy1", "title": "Submission 78TUY1", "payload": {"code": "def segment_totals(values, marker):\n out=[]; total=0\n for v in values:\n if v==marker: out.append(total); total=0\n else: total+=v\n out.append(total)\n return out", "input": "segment_totals([1, -1, 9, 2, 9, 3], 9)", "language": "Python", "predicted_output": "[0, 2, 3]"}}
{"submissionId": "cmsrh0irb0086y8p2wbqhfwfj", "title": "Submission QHFWFJ", "payload": {"code": "def index_peaks(values):\n return [i for i in range(1,len(values)-1) if values[i]>values[i-1] and values[i]>values[i+1]]", "input": "index_peaks([1, 5, 2, 6, 3, 4])", "language": "Python", "predicted_output": "[1, 3]"}}
{"submissionId": "cmsrh0irb0087y8p2k2mjhsg2", "title": "Submission MJHSG2", "payload": {"code": "def index_peaks(values):\n return [i for i in range(1,len(values)-1) if values[i]>values[i-1] and values[i]>values[i+1]]", "input": "index_peaks([9, 8, 7, 8, 7])", "language": "Python", "predicted_output": "[3]"}}
{"submissionId": "cmsrh0irb0088y8p2zczm29bs", "title": "Submission ZM29BS", "payload": {"code": "def rolling_range(values, size):\n return [max(values[i:i+size])-min(values[i:i+size]) for i in range(len(values)-size+1)]", "input": "rolling_range([3, 8, 2, 7, 5], 3)", "language": "Python", "predicted_output": "[6, 6, 5]"}}
{"submissionId": "cmsrh0irb0089y8p2r3b89c5r", "title": "Submission B89C5R", "payload": {"code": "def rolling_range(values, size):\n return [max(values[i:i+size])-min(values[i:i+size]) for i in range(len(values)-size+1)]", "input": "rolling_range([10, 9, 6, 8], 2)", "language": "Python", "predicted_output": "[1, 3, 2]"}}
{"submissionId": "cmsrh0irb008ay8p26g7zoed1", "title": "Submission 7ZOED1", "payload": {"code": "def stable_partition(values, divisor):\n return [v for v in values if v%divisor==0]+[v for v in values if v%divisor!=0]", "input": "stable_partition([5, 6, 4, 9, 8], 2)", "language": "Python", "predicted_output": "[6, 4, 8, 5, 9]"}}
{"submissionId": "cmsrh0irb008by8p2fiif8dfg", "title": "Submission IF8DFG", "payload": {"code": "def stable_partition(values, divisor):\n return [v for v in values if v%divisor==0]+[v for v in values if v%divisor!=0]", "input": "stable_partition([3, 10, 15, 8, 20], 5)", "language": "Python", "predicted_output": "[10, 15, 20, 3, 8]"}}
{"submissionId": "cmsrk8iip0000jmp283390488", "title": "Submission 390488", "payload": {"code": "def merge_intervals(intervals):\n intervals = sorted(intervals)\n merged = []\n for start, end in intervals:\n if merged and start <= merged[-1][1]:\n merged[-1] = (merged[-1][0], max(merged[-1][1], end))\n else:\n merged.append((start, end))\n return merged", "input": "merge_intervals([(5, 8), (1, 3), (2, 6), (10, 12)])", "language": "Python", "predicted_output": "[(1, 8), (10, 12)]"}}
{"submissionId": "cmsrk8iiq0001jmp2o0hw4p3t", "title": "Submission HW4P3T", "payload": {"code": "def rotate_and_flag(matrix):\n rotated = [list(row) for row in zip(*matrix[::-1])]\n flags = [sum(row) % 2 == 0 for row in rotated]\n return rotated, flags", "input": "rotate_and_flag([[1, 2], [3, 4]])", "language": "Python", "predicted_output": "([[3, 1], [4, 2]], [True, True])"}}
{"submissionId": "cmsrk8iiq0002jmp233jr833y", "title": "Submission JR833Y", "payload": {"code": "def parse_versions(tags):\n parsed = []\n for tag in tags:\n try:\n parts = tuple(int(p) for p in tag.lstrip('v').split('.'))\n parsed.append(parts)\n except ValueError:\n parsed.append(None)\n return sorted(p for p in parsed if p is not None), parsed.count(None)", "input": "parse_versions(['v1.2.10', 'v1.2.3', 'beta', 'v0.9'])", "language": "Python", "predicted_output": "([(0, 9), (1, 2, 3), (1, 2, 10)], 1)"}}
{"submissionId": "cmsrk8iiq0003jmp2go483anz", "title": "Submission 483ANZ", "payload": {"code": "def dedupe_keep_last(pairs):\n seen = {}\n for key, value in pairs:\n seen[key] = value\n return list(seen.items())", "input": "dedupe_keep_last([('a', 1), ('b', 2), ('a', 3), ('c', 4), ('b', 5)])", "language": "Python", "predicted_output": "[('a', 3), ('b', 5), ('c', 4)]"}}
{"submissionId": "cmsrk8iiq0004jmp2waisuzyp", "title": "Submission ISUZYP", "payload": {"code": "def bucket_grades(scores):\n buckets = {'high': [], 'mid': [], 'low': []}\n for name, score in scores.items():\n key = 'high' if score >= 85 else 'mid' if score >= 60 else 'low'\n buckets[key].append(name)\n return {k: sorted(v) for k, v in buckets.items() if v}", "input": "bucket_grades({'ana': 91, 'bo': 60, 'cy': 59, 'di': 85})", "language": "Python", "predicted_output": "{'high': ['ana', 'di'], 'mid': ['bo'], 'low': ['cy']}"}}
{"submissionId": "cmsrk8iiq0006jmp2d7atu5qv", "title": "Submission ATU5QV", "payload": {"code": "def safe_lookup_chain(data, path):\n current = data\n trail = []\n for key in path.split('.'):\n try:\n current = current[key]\n trail.append(key)\n except (KeyError, TypeError):\n return {'found': False, 'trail': trail}\n return {'found': True, 'value': current, 'trail': trail}", "input": "safe_lookup_chain({'a': {'b': {'c': 7}}}, 'a.b.x')", "language": "Python", "predicted_output": "{'found': False, 'trail': ['a', 'b']}"}}
{"submissionId": "cmsrk8iiq0007jmp2a5k9bh05", "title": "Submission K9BH05", "payload": {"code": "def window_max(values, k):\n if k <= 0 or k > len(values):\n raise ValueError('bad window')\n return [max(values[i:i + k]) for i in range(len(values) - k + 1)]\n\ndef try_windows(values, sizes):\n out = {}\n for k in sizes:\n try:\n out[k] = window_max(values, k)\n except ValueError as e:\n out[k] = str(e)\n return out", "input": "try_windows([3, 1, 4, 1, 5], [2, 6])", "language": "Python", "predicted_output": "{2: [3, 4, 4, 5], 6: 'bad window'}"}}
{"submissionId": "cmsrk8iiq0008jmp2bbg6qua1", "title": "Submission G6QUA1", "payload": {"code": "def interleave_uneven(*seqs):\n result = []\n i = 0\n while any(i < len(s) for s in seqs):\n for s in seqs:\n if i < len(s):\n result.append(s[i])\n i += 1\n return result", "input": "interleave_uneven([1, 2, 3], ['a'], [True, False])", "language": "Python", "predicted_output": "[1, 'a', True, 2, False, 3]"}}
{"submissionId": "cmsrk8iiq0009jmp24nfyyby8", "title": "Submission FYYBY8", "payload": {"code": "def balance_report(entries):\n balance = 0\n low = 0\n overdrafts = 0\n for amount in entries:\n balance += amount\n if balance < low:\n low = balance\n if balance < 0:\n overdrafts += 1\n return {'final': balance, 'lowest': low, 'overdraft_steps': overdrafts}", "input": "balance_report([100, -150, 30, -20, 80])", "language": "Python", "predicted_output": "{'final': 40, 'lowest': -50, 'overdraft_steps': 3}"}}
{"submissionId": "cmsrk8iiq000ajmp26a8mrqmq", "title": "Submission 8MRQMQ", "payload": {"code": "def expand_ranges(spec):\n pages = set()\n for part in spec.split(','):\n part = part.strip()\n if '-' in part:\n a, b = part.split('-')\n pages.update(range(int(a), int(b) + 1))\n else:\n pages.add(int(part))\n return sorted(pages)", "input": "expand_ranges('1, 4-6, 5, 9')", "language": "Python", "predicted_output": "[1, 4, 5, 6, 9]"}}
{"submissionId": "cmsrk8iiq000bjmp2t4okouzv", "title": "Submission OKOUZV", "payload": {"code": "def summarize_types(values):\n from collections import Counter\n counts = Counter(type(v).__name__ for v in values)\n return sorted(counts.items(), key=lambda kv: (-kv[1], kv[0]))", "input": "summarize_types([1, 'a', 2.0, True, 'b', None, 3])", "language": "Python", "predicted_output": "[('int', 2), ('str', 2), ('NoneType', 1), ('bool', 1), ('float', 1)]"}}
{"submissionId": "cmssht3ma007gjmp24693qh9o", "title": "Submission 93QH9O", "payload": {"code": "def flatten_once(nested):\n result = []\n for item in nested:\n if isinstance(item, list):\n result.extend(item)\n else:\n result.append(item)\n return result", "input": "flatten_once([[1, 2], 3, [4, [5, 6]]])", "language": "Python", "predicted_output": "[1, 2, 3, 4, [5, 6]]"}}
{"submissionId": "cmssht3ma007hjmp24m04bdab", "title": "Submission 04BDAB", "payload": {"code": "def count_vowels(s):\n vowels = set('aeiouAEIOU')\n return sum(1 for ch in s if ch in vowels)", "input": "count_vowels('Hello World')", "language": "Python", "predicted_output": "3"}}
{"submissionId": "cmssht3ma007ijmp21vviay6o", "title": "Submission VIAY6O", "payload": {"code": "def merge_dicts_sum(d1, d2):\n result = dict(d1)\n for k, v in d2.items():\n result[k] = result.get(k, 0) + v\n return result", "input": "merge_dicts_sum({'a': 1, 'b': 2}, {'b': 3, 'c': 4})", "language": "Python", "predicted_output": "{'a': 1, 'b': 5, 'c': 4}"}}
{"submissionId": "cmssht3ma007jjmp2rfwsojd9", "title": "Submission WSOJD9", "payload": {"code": "def rotating_cipher(text, shift):\n result = []\n for ch in text:\n if ch.isalpha():\n base = ord('A') if ch.isupper() else ord('a')\n result.append(chr((ord(ch) - base + shift) % 26 + base))\n else:\n result.append(ch)\n return ''.join(result)", "input": "rotating_cipher('Xyz!', 3)", "language": "Python", "predicted_output": "Abc!"}}
{"submissionId": "cmssht3ma007kjmp2dfwba04x", "title": "Submission WBA04X", "payload": {"code": "def partition_even_odd(nums):\n evens = [x for x in nums if x % 2 == 0]\n odds = [x for x in nums if x % 2 != 0]\n return evens, odds", "input": "partition_even_odd([1, 2, 3, 4, 5, 6])", "language": "Python", "predicted_output": "([2, 4, 6], [1, 3, 5])"}}
{"submissionId": "cmssht3ma007ljmp29yn7yjjx", "title": "Submission N7YJJX", "payload": {"code": "def cumulative_max(values):\n if not values:\n return []\n result = [values[0]]\n for v in values[1:]:\n result.append(max(result[-1], v))\n return result", "input": "cumulative_max([3, 1, 4, 1, 5, 9, 2, 6])", "language": "Python", "predicted_output": "[3, 3, 4, 4, 5, 9, 9, 9]"}}
{"submissionId": "cmssht3ma007mjmp2lafub73t", "title": "Submission FUB73T", "payload": {"code": "def word_frequency(sentence):\n freq = {}\n for word in sentence.split():\n freq[word] = freq.get(word, 0) + 1\n return freq", "input": "word_frequency('the cat sat on the mat the cat')", "language": "Python", "predicted_output": "{'the': 3, 'cat': 2, 'sat': 1, 'on': 1, 'mat': 1}"}}
{"submissionId": "cmssht3ma007njmp2p0ghw1j2", "title": "Submission GHW1J2", "payload": {"code": "def safe_divide(a, b):\n try:\n result = a / b\n except ZeroDivisionError:\n return (None, 'division by zero')\n return (result, 'ok')", "input": "(safe_divide(10, 4), safe_divide(5, 0))", "language": "Python", "predicted_output": "((2.5, 'ok'), (None, 'division by zero'))"}}
{"submissionId": "cmssht3ma007ojmp2zjk35ocu", "title": "Submission K35OCU", "payload": {"code": "def deduplicate_preserve_order(seq):\n seen = set()\n result = []\n for item in seq:\n if item not in seen:\n seen.add(item)\n result.append(item)\n return result", "input": "deduplicate_preserve_order([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5])", "language": "Python", "predicted_output": "[3, 1, 4, 5, 9, 2, 6]"}}
{"submissionId": "cmssht3ma007pjmp2f7lww1cf", "title": "Submission LWW1CF", "payload": {"code": "def matrix_diagonal_sum(matrix):\n return sum(matrix[i][i] for i in range(len(matrix)))", "input": "matrix_diagonal_sum([[1, 2, 3], [4, 5, 6], [7, 8, 9]])", "language": "Python", "predicted_output": "15"}}
{"submissionId": "cmssht3ma007qjmp2uwfw24av", "title": "Submission FW24AV", "payload": {"code": "def chunked(lst, n):\n return [lst[i:i+n] for i in range(0, len(lst), n)]", "input": "chunked([1, 2, 3, 4, 5, 6, 7], 3)", "language": "Python", "predicted_output": "[[1, 2, 3], [4, 5, 6], [7]]"}}
{"submissionId": "cmssht3ma007rjmp2bmcjmm3r", "title": "Submission CJMM3R", "payload": {"code": "def clamp(value, lo, hi):\n return max(lo, min(value, hi))\n\ndef clamp_list(values, lo, hi):\n return [clamp(v, lo, hi) for v in values]", "input": "clamp_list([-5, 0, 3, 7, 10, 15], 0, 10)", "language": "Python", "predicted_output": "[0, 0, 3, 7, 10, 10]"}}
{"submissionId": "cmssht3ma007sjmp2mw7ivr38", "title": "Submission 7IVR38", "payload": {"code": "def nested_sum(data):\n total = 0\n for item in data:\n if isinstance(item, list):\n total += nested_sum(item)\n else:\n total += item\n return total", "input": "nested_sum([1, [2, 3], [4, [5, 6]], 7])", "language": "Python", "predicted_output": "28"}}
{"submissionId": "cmssht3ma007tjmp2d7sbal7k", "title": "Submission SBAL7K", "payload": {"code": "def most_common(items):\n freq = {}\n for item in items:\n freq[item] = freq.get(item, 0) + 1\n return max(freq, key=freq.get)", "input": "most_common(['apple', 'banana', 'apple', 'cherry', 'banana', 'apple'])", "language": "Python", "predicted_output": "apple"}}
{"submissionId": "cmssht3ma007ujmp2jglrz2a4", "title": "Submission LRZ2A4", "payload": {"code": "def zip_with_index(items, start=0):\n return [(i + start, item) for i, item in enumerate(items)]", "input": "zip_with_index(['a', 'b', 'c'], start=1)", "language": "Python", "predicted_output": "[(1, 'a'), (2, 'b'), (3, 'c')]"}}
{"submissionId": "cmssht3ma007wjmp2wmzkgzkt", "title": "Submission ZKGZKT", "payload": {"code": "def interleave(a, b):\n result = []\n for x, y in zip(a, b):\n result.extend([x, y])\n if len(a) > len(b):\n result.extend(a[len(b):])\n elif len(b) > len(a):\n result.extend(b[len(a):])\n return result", "input": "interleave([1, 3, 5], [2, 4])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5]"}}
{"submissionId": "cmssht3ma007xjmp2kzoylwhw", "title": "Submission OYLWHW", "payload": {"code": "def transpose(matrix):\n if not matrix or not matrix[0]:\n return []\n return [[row[i] for row in matrix] for i in range(len(matrix[0]))]", "input": "transpose([[1, 2, 3], [4, 5, 6]])", "language": "Python", "predicted_output": "[[1, 4], [2, 5], [3, 6]]"}}
{"submissionId": "cmssht3mb007yjmp2im72inmd", "title": "Submission 72INMD", "payload": {"code": "def count_palindromes(words):\n return sum(1 for w in words if w == w[::-1])", "input": "count_palindromes(['racecar', 'hello', 'level', 'world', 'madam'])", "language": "Python", "predicted_output": "3"}}
{"submissionId": "cmssht3mb007zjmp2qtd1s1fg", "title": "Submission D1S1FG", "payload": {"code": "def group_by_first_letter(words):\n groups = {}\n for word in words:\n key = word[0].lower()\n groups.setdefault(key, []).append(word)\n return groups", "input": "group_by_first_letter(['Apple', 'ant', 'Banana', 'bee', 'avocado'])", "language": "Python", "predicted_output": "{'a': ['Apple', 'ant', 'avocado'], 'b': ['Banana', 'bee']}"}}
{"submissionId": "cmssht3mb0080jmp2fj12d96t", "title": "Submission 12D96T", "payload": {"code": "def sliding_window_sum(lst, window):\n if window > len(lst):\n return []\n return [sum(lst[i:i+window]) for i in range(len(lst) - window + 1)]", "input": "sliding_window_sum([1, 2, 3, 4, 5], 3)", "language": "Python", "predicted_output": "[6, 9, 12]"}}
{"submissionId": "cmssht3mb0081jmp2j3d25r6e", "title": "Submission D25R6E", "payload": {"code": "def compress_runs(lst):\n if not lst:\n return []\n result = [(lst[0], 1)]\n for item in lst[1:]:\n if item == result[-1][0]:\n result[-1] = (result[-1][0], result[-1][1] + 1)\n else:\n result.append((item, 1))\n return result", "input": "compress_runs([1, 1, 2, 3, 3, 3, 1])", "language": "Python", "predicted_output": "[(1, 2), (2, 1), (3, 3), (1, 1)]"}}
{"submissionId": "cmssht3mb0082jmp2aoyfmgov", "title": "Submission YFMGOV", "payload": {"code": "def invert_dict(d):\n inverted = {}\n for k, v in d.items():\n inverted.setdefault(v, []).append(k)\n return inverted", "input": "invert_dict({'a': 1, 'b': 2, 'c': 1, 'd': 3})", "language": "Python", "predicted_output": "{1: ['a', 'c'], 2: ['b'], 3: ['d']}"}}
{"submissionId": "cmssht3mb0083jmp2tsp9n5bk", "title": "Submission P9N5BK", "payload": {"code": "def apply_until_stable(func, value, max_steps=100):\n for _ in range(max_steps):\n next_val = func(value)\n if next_val == value:\n return value\n value = next_val\n return value", "input": "apply_until_stable(lambda x: x // 2 if x > 1 else x, 64)", "language": "Python", "predicted_output": "1"}}
{"submissionId": "cmssht3mb0084jmp28kds0eff", "title": "Submission DS0EFF", "payload": {"code": "def parse_key_value(pairs, sep='='):\n result = {}\n for pair in pairs:\n if sep in pair:\n k, _, v = pair.partition(sep)\n result[k.strip()] = v.strip()\n return result", "input": "parse_key_value(['name = Alice', 'age = 30', 'invalid', 'city = Paris'])", "language": "Python", "predicted_output": "{'name': 'Alice', 'age': '30', 'city': 'Paris'}"}}
{"submissionId": "cmsshvjsl00a8jmp2e2m89pfo", "title": "Submission M89PFO", "payload": {"code": "def running_median(values):\n import heapq\n lo, hi = [], []\n result = []\n for v in values:\n if not lo or v <= -lo[0]:\n heapq.heappush(lo, -v)\n else:\n heapq.heappush(hi, v)\n if len(lo) > len(hi) + 1:\n heapq.heappush(hi, -heapq.heappop(lo))\n elif len(hi) > len(lo):\n heapq.heappush(lo, -heapq.heappop(hi))\n if len(lo) == len(hi):\n result.append((-lo[0] + hi[0]) / 2)\n else:\n result.append(float(-lo[0]))\n return result", "input": "running_median([5, 2, 8, 1, 9])", "language": "Python", "predicted_output": "[5.0, 3.5, 5.0, 3.5, 5.0]"}}
{"submissionId": "cmsshxe3w00bnjmp2l5a00u7g", "title": "Submission A00U7G", "payload": {"code": "def word_frequencies_top_n(text, n):\n import re\n from collections import Counter\n words = re.findall(r\"[a-z']+\", text.lower())\n counts = Counter(words)\n return sorted(counts.items(), key=lambda kv: (-kv[1], kv[0]))[:n]", "input": "word_frequencies_top_n(\"The quick brown fox. The Fox jumps! the dog barks, the dog runs.\", 3)", "language": "Python", "predicted_output": "[('the', 4), ('dog', 2), ('fox', 2)]"}}
{"submissionId": "cmsshxwcg00bojmp2kbm7qxyi", "title": "Submission M7QXYI", "payload": {"code": "def safe_divide_chain(pairs):\n results = []\n for a, b in pairs:\n try:\n results.append(a / b)\n except ZeroDivisionError:\n results.append(None)\n except TypeError:\n results.append('type_error')\n return results", "input": "safe_divide_chain([(10, 2), (5, 0), ('x', 2), (9, 3)])", "language": "Python", "predicted_output": "[5.0, None, 'type_error', 3.0]"}}
{"submissionId": "cmsshypqd00bpjmp2yjz9ar9r", "title": "Submission Z9AR9R", "payload": {"code": "def memoized_fib(n, cache=None):\n if cache is None:\n cache = {}\n if n in cache:\n return cache[n]\n if n <= 1:\n return n\n result = memoized_fib(n - 1, cache) + memoized_fib(n - 2, cache)\n cache[n] = result\n return result\n\ndef fib_sequence(count):\n return [memoized_fib(i) for i in range(count)]", "input": "fib_sequence(10)", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]"}}
{"submissionId": "cmsshzf3200bqjmp2yddnr01j", "title": "Submission DNR01J", "payload": {"code": "def flatten_nested(data, depth=0):\n result = []\n for item in data:\n if isinstance(item, list) and depth < 2:\n result.extend(flatten_nested(item, depth + 1))\n else:\n result.append(item)\n return result", "input": "flatten_nested([1, [2, 3, [4, [5, 6]]], 7, [8]])", "language": "Python", "predicted_output": "[1, 2, 3, 4, [5, 6], 7, 8]"}}
{"submissionId": "cmsshzf3300brjmp25ku495m8", "title": "Submission U495M8", "payload": {"code": "def group_anagrams(words):\n groups = {}\n for w in words:\n key = ''.join(sorted(w))\n groups.setdefault(key, []).append(w)\n return sorted(groups.values(), key=lambda g: (-len(g), g[0]))", "input": "group_anagrams(['eat', 'tea', 'tan', 'ate', 'nat', 'bat'])", "language": "Python", "predicted_output": "[['eat', 'tea', 'ate'], ['tan', 'nat'], ['bat']]"}}
{"submissionId": "cmsshzf3300bsjmp2mnt4tg5r", "title": "Submission T4TG5R", "payload": {"code": "def sliding_window_max(nums, k):\n from collections import deque\n dq = deque()\n result = []\n for i, n in enumerate(nums):\n while dq and nums[dq[-1]] <= n:\n dq.pop()\n dq.append(i)\n if dq[0] <= i - k:\n dq.popleft()\n if i >= k - 1:\n result.append(nums[dq[0]])\n return result", "input": "sliding_window_max([1, 3, -1, -3, 5, 3, 6, 7], 3)", "language": "Python", "predicted_output": "[3, 3, 5, 5, 6, 7]"}}
{"submissionId": "cmsshzf3300btjmp2gd4k94bj", "title": "Submission 4K94BJ", "payload": {"code": "class RateLimiter:\n def __init__(self, limit):\n self.limit = limit\n self.count = 0\n self.history = []\n\n def allow(self, ts):\n self.history = [t for t in self.history if t > ts - 10]\n if len(self.history) < self.limit:\n self.history.append(ts)\n return True\n return False\n\ndef simulate(events):\n rl = RateLimiter(2)\n return [rl.allow(t) for t in events]", "input": "simulate([1, 2, 3, 12, 13, 25])", "language": "Python", "predicted_output": "[True, True, False, True, True, True]"}}
{"submissionId": "cmsshzf3300bujmp2rc52bm9l", "title": "Submission 52BM9L", "payload": {"code": "def matrix_transpose_and_sum(matrix):\n transposed = list(zip(*matrix))\n row_sums = [sum(row) for row in transposed]\n return transposed, row_sums", "input": "matrix_transpose_and_sum([[1, 2, 3], [4, 5, 6]])", "language": "Python", "predicted_output": "([(1, 4), (2, 5), (3, 6)], [5, 7, 9])"}}
{"submissionId": "cmsshzf3300bvjmp2jhqmnf7o", "title": "Submission QMNF7O", "payload": {"code": "def parse_kv_config(text):\n config = {}\n for line in text.strip().split('\\n'):\n line = line.strip()\n if not line or line.startswith('#'):\n continue\n if '=' not in line:\n raise ValueError(f'bad line: {line}')\n k, v = line.split('=', 1)\n k, v = k.strip(), v.strip()\n if v.isdigit():\n v = int(v)\n elif v in ('true', 'false'):\n v = v == 'true'\n config[k] = v\n return config", "input": "parse_kv_config('# config\\nhost = localhost\\nport=8080\\ndebug=true\\n\\nretries = 3')", "language": "Python", "predicted_output": "{'host': 'localhost', 'port': 8080, 'debug': True, 'retries': 3}"}}
{"submissionId": "cmsshzf3300bwjmp24h0r63l9", "title": "Submission 0R63L9", "payload": {"code": "def decorator_call_counter():\n calls = {}\n def decorator(fn):\n def wrapper(*args):\n calls[fn.__name__] = calls.get(fn.__name__, 0) + 1\n return fn(*args)\n return wrapper\n return decorator, calls\n\ndef build():\n dec, calls = decorator_call_counter()\n\n @dec\n def add(a, b):\n return a + b\n\n results = [add(1, 2), add(3, 4), add(5, 6)]\n return results, calls", "input": "build()", "language": "Python", "predicted_output": "([3, 7, 11], {'add': 3})"}}
{"submissionId": "cmsshzf3300bxjmp2jfcuteta", "title": "Submission CUTETA", "payload": {"code": "def bracket_validity_stack(s):\n pairs = {')': '(', ']': '[', '}': '{'}\n stack = []\n for ch in s:\n if ch in '([{':\n stack.append(ch)\n elif ch in ')]}':\n if not stack or stack.pop() != pairs[ch]:\n return False\n return not stack\n\ndef check_all(strings):\n return [bracket_validity_stack(s) for s in strings]", "input": "check_all(['(a[b]{c})', '([)]', '((()))', '{[()]}('])", "language": "Python", "predicted_output": "[True, False, True, False]"}}
{"submissionId": "cmsshzf3300byjmp22g0rf2od", "title": "Submission 0RF2OD", "payload": {"code": "def generator_chain(n):\n def evens():\n for i in range(n):\n if i % 2 == 0:\n yield i\n def squares(gen):\n for v in gen:\n yield v * v\n return list(squares(evens()))", "input": "generator_chain(10)", "language": "Python", "predicted_output": "[0, 4, 16, 36, 64]"}}
{"submissionId": "cmsshzf3300bzjmp21oo82fux", "title": "Submission O82FUX", "payload": {"code": "def dedupe_preserve_order_with_key(items, key):\n seen = set()\n result = []\n for item in items:\n k = key(item)\n if k not in seen:\n seen.add(k)\n result.append(item)\n return result\n\ndef dedupe_by_id(items):\n return dedupe_preserve_order_with_key(items, lambda d: d['id'])", "input": "dedupe_by_id([{'id': 1, 'v': 'a'}, {'id': 2, 'v': 'b'}, {'id': 1, 'v': 'c'}])", "language": "Python", "predicted_output": "[{'id': 1, 'v': 'a'}, {'id': 2, 'v': 'b'}]"}}
{"submissionId": "cmsshzf3300c0jmp2z1klnw2h", "title": "Submission KLNW2H", "payload": {"code": "def custom_exception_chain():\n class ValidationError(Exception):\n pass\n\n def validate(age):\n if age < 0:\n raise ValidationError('negative age')\n if age > 150:\n raise ValidationError('unrealistic age')\n return age\n\n results = []\n for age in [25, -5, 200, 40]:\n try:\n results.append(validate(age))\n except ValidationError as e:\n results.append(str(e))\n return results", "input": "custom_exception_chain()", "language": "Python", "predicted_output": "[25, 'negative age', 'unrealistic age', 40]"}}
{"submissionId": "cmsshzf3300c1jmp2kthupyjq", "title": "Submission HUPYJQ", "payload": {"code": "def binary_search_insert_position(sorted_list, targets):\n import bisect\n return [bisect.bisect_left(sorted_list, t) for t in targets]", "input": "binary_search_insert_position([1, 3, 5, 7, 9, 11], [0, 4, 5, 12, 8])", "language": "Python", "predicted_output": "[0, 2, 2, 6, 4]"}}
{"submissionId": "cmsshzf3300c2jmp2139cqdf8", "title": "Submission 9CQDF8", "payload": {"code": "def context_manager_log():\n log = []\n\n class Timer:\n def __init__(self, name):\n self.name = name\n def __enter__(self):\n log.append(f'enter:{self.name}')\n return self\n def __exit__(self, exc_type, exc_val, exc_tb):\n log.append(f'exit:{self.name}')\n return exc_type is ValueError\n\n with Timer('a'):\n log.append('inside_a')\n try:\n with Timer('b'):\n log.append('inside_b')\n raise ValueError('boom')\n except ValueError:\n log.append('caught_outside')\n return log", "input": "context_manager_log()", "language": "Python", "predicted_output": "['enter:a', 'inside_a', 'exit:a', 'enter:b', 'inside_b', 'exit:b']"}}
{"submissionId": "cmsshzf3300c3jmp2umrfq2xl", "title": "Submission RFQ2XL", "payload": {"code": "def multi_key_sort_with_ties(records):\n return sorted(records, key=lambda r: (-r['score'], r['name']))", "input": "multi_key_sort_with_ties([{'name': 'bob', 'score': 90}, {'name': 'amy', 'score': 90}, {'name': 'cid', 'score': 95}, {'name': 'ann', 'score': 90}])", "language": "Python", "predicted_output": "[{'name': 'cid', 'score': 95}, {'name': 'amy', 'score': 90}, {'name': 'ann', 'score': 90}, {'name': 'bob', 'score': 90}]"}}
{"submissionId": "cmssiaa5l00fhjmp280gd7npi", "title": "Submission GD7NPI", "payload": {"code": "class Point:\n def __init__(self, x, y):\n self.x = x\n self.y = y\n def __eq__(self, other):\n return isinstance(other, Point) and self.x == other.x and self.y == other.y\n def __hash__(self):\n return hash((self.x, self.y))\n def __repr__(self):\n return f\"Point({self.x},{self.y})\"\n\ndef dedupe_points(points):\n return sorted(set(points), key=lambda p: (p.x, p.y))", "input": "dedupe_points([Point(1,2), Point(3,4), Point(1,2), Point(0,0), Point(3,4)])", "language": "Python", "predicted_output": "[Point(0,0), Point(1,2), Point(3,4)]"}}
{"submissionId": "cmssibcce00fijmp25knukchb", "title": "Submission NUKCHB", "payload": {"code": "def countdown(n):\n while n > 0:\n yield n\n n -= 1\n\ndef take_then_check(n, k):\n gen = countdown(n)\n taken = []\n exhausted_early = False\n for _ in range(k):\n try:\n taken.append(next(gen))\n except StopIteration:\n exhausted_early = True\n break\n remaining = list(gen)\n return taken, remaining, exhausted_early", "input": "take_then_check(3, 5)", "language": "Python", "predicted_output": "([3, 2, 1], [], True)"}}
{"submissionId": "cmssic2tm00fjjmp2sjbrdya3", "title": "Submission BRDYA3", "payload": {"code": "def classify(n):\n log = []\n try:\n if n == 0:\n raise ZeroDivisionError(\"zero\")\n result = 100 / n\n except ZeroDivisionError as e:\n log.append(f\"error:{e}\")\n result = None\n else:\n log.append(\"no-error\")\n finally:\n log.append(\"done\")\n return result, log", "input": "classify(0)", "language": "Python", "predicted_output": "(None, ['error:zero', 'done'])"}}
{"submissionId": "cmssidxll00g6jmp2su60wlfg", "title": "Submission 60WLFG", "payload": {"code": "def word_stats(words):\n lengths = {w: len(w) for w in words if not w.startswith(\"_\")}\n unique_lengths = {len(w) for w in words if len(w) > 2}\n return lengths, sorted(unique_lengths)", "input": "word_stats([\"hi\", \"_skip\", \"hello\", \"ok\", \"world\", \"_x\"])", "language": "Python", "predicted_output": "({'hi': 2, 'hello': 5, 'ok': 2, 'world': 5}, [5])"}}
{"submissionId": "cmssidxll00g7jmp22qtwjnjr", "title": "Submission TWJNJR", "payload": {"code": "from functools import lru_cache\n\n@lru_cache(maxsize=None)\ndef num_ways(n):\n if n < 0:\n return 0\n if n == 0:\n return 1\n return num_ways(n - 1) + num_ways(n - 2) + num_ways(n - 3)", "input": "tuple(num_ways(i) for i in range(7))", "language": "Python", "predicted_output": "(1, 1, 2, 4, 7, 13, 24)"}}
{"submissionId": "cmssidxll00g8jmp225vepn84", "title": "Submission VEPN84", "payload": {"code": "import itertools\n\ndef group_consecutive(values):\n result = []\n for key, group in itertools.groupby(values):\n result.append((key, len(list(group))))\n return result", "input": "group_consecutive([1, 1, 2, 2, 2, 1, 3, 3])", "language": "Python", "predicted_output": "[(1, 2), (2, 3), (1, 1), (3, 2)]"}}
{"submissionId": "cmssidxll00g9jmp2gbetuiq4", "title": "Submission ETUIQ4", "payload": {"code": "def rank_scores(entries):\n return sorted(entries, key=lambda e: (-e[1], e[0]))", "input": "rank_scores([(\"bob\", 90), (\"amy\", 95), (\"cid\", 90), (\"dee\", 95), (\"al\", 90)])", "language": "Python", "predicted_output": "[('amy', 95), ('dee', 95), ('al', 90), ('bob', 90), ('cid', 90)]"}}
{"submissionId": "cmssidxll00gajmp2rvt5ru5a", "title": "Submission T5RU5A", "payload": {"code": "def accumulate(value, bucket=[]):\n bucket.append(value)\n return bucket", "input": "(accumulate(1), accumulate(2), accumulate(3, []))", "language": "Python", "predicted_output": "([1, 2], [1, 2], [3])"}}
{"submissionId": "cmssidxll00gbjmp26857gtmw", "title": "Submission 57GTMW", "payload": {"code": "class SuppressValueError:\n def __enter__(self):\n return self\n def __exit__(self, exc_type, exc_val, exc_tb):\n return exc_type is ValueError\n\ndef run_with_suppress():\n log = []\n with SuppressValueError():\n log.append(\"before\")\n raise ValueError(\"bad\")\n log.append(\"never\")\n log.append(\"after\")\n return log", "input": "run_with_suppress()", "language": "Python", "predicted_output": "['before', 'after']"}}
{"submissionId": "cmssidxll00gcjmp2f0539elq", "title": "Submission 539ELQ", "payload": {"code": "import functools\n\ndef count_calls(func):\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n wrapper.calls += 1\n return func(*args, **kwargs)\n wrapper.calls = 0\n return wrapper\n\n@count_calls\ndef square(x):\n return x * x", "input": "([square(x) for x in range(4)], square.calls, square.__name__)", "language": "Python", "predicted_output": "([0, 1, 4, 9], 4, 'square')"}}
{"submissionId": "cmssidxll00gdjmp2xoat1j3x", "title": "Submission AT1J3X", "payload": {"code": "class Temperature:\n def __init__(self, celsius):\n self._celsius = celsius\n\n @property\n def celsius(self):\n return self._celsius\n\n @celsius.setter\n def celsius(self, value):\n if value < -273.15:\n raise ValueError(\"too cold\")\n self._celsius = value\n\n @property\n def fahrenheit(self):\n return self._celsius * 9 / 5 + 32\n\ndef adjust(temp_c, delta):\n t = Temperature(temp_c)\n try:\n t.celsius += delta\n return round(t.fahrenheit, 2)\n except ValueError:\n return \"invalid\"", "input": "(adjust(20, 5), adjust(-270, -10))", "language": "Python", "predicted_output": "(77.0, 'invalid')"}}
{"submissionId": "cmssidxll00gejmp2ohvqbll5", "title": "Submission VQBLL5", "payload": {"code": "from collections import namedtuple\n\nEmployee = namedtuple(\"Employee\", [\"name\", \"salary\", \"dept\"])\n\ndef raise_salaries(employees, pct):\n return [e._replace(salary=round(e.salary * (1 + pct), 2)) for e in employees]", "input": "raise_salaries([Employee(\"Ann\", 50000, \"Eng\"), Employee(\"Bo\", 60000, \"Sales\")], 0.1)", "language": "Python", "predicted_output": "[Employee(name='Ann', salary=55000.0, dept='Eng'), Employee(name='Bo', salary=66000.0, dept='Sales')]"}}
{"submissionId": "cmssidxll00ggjmp2dwwom0bh", "title": "Submission WOM0BH", "payload": {"code": "def parse_int(s):\n try:\n return int(s)\n except ValueError as e:\n raise RuntimeError(f\"bad value: {s}\") from e\n\ndef safe_parse(values):\n results = []\n for v in values:\n try:\n results.append(parse_int(v))\n except RuntimeError as e:\n results.append((str(e), type(e.__cause__).__name__))\n return results", "input": "safe_parse([\"12\", \"abc\", \"-5\"])", "language": "Python", "predicted_output": "[12, ('bad value: abc', 'ValueError'), -5]"}}
{"submissionId": "cmssidxll00ghjmp2mh8xk9cs", "title": "Submission 8XK9CS", "payload": {"code": "def transform(seq):\n reversed_seq = seq[::-1]\n every_other = seq[1::2]\n middle_out = seq[len(seq)//4 : -(len(seq)//4)] if len(seq) >= 4 else seq\n return reversed_seq, every_other, middle_out", "input": "transform([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])", "language": "Python", "predicted_output": "([9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [1, 3, 5, 7, 9], [2, 3, 4, 5, 6, 7])"}}
{"submissionId": "cmssidxll00gijmp270pxaguh", "title": "Submission PXAGUH", "payload": {"code": "def make_multipliers_bad():\n return [lambda x: x * i for i in range(3)]\n\ndef make_multipliers_fixed():\n return [lambda x, i=i: x * i for i in range(3)]\n\ndef apply_all(funcs, x):\n return [f(x) for f in funcs]", "input": "(apply_all(make_multipliers_bad(), 10), apply_all(make_multipliers_fixed(), 10))", "language": "Python", "predicted_output": "([20, 20, 20], [0, 10, 20])"}}
{"submissionId": "cmssidxll00gjjmp2n8e4y8nd", "title": "Submission E4Y8ND", "payload": {"code": "class Vector:\n def __init__(self, x, y):\n self.x, self.y = x, y\n def __add__(self, other):\n if isinstance(other, Vector):\n return Vector(self.x + other.x, self.y + other.y)\n return NotImplemented\n def __radd__(self, other):\n if other == 0:\n return self\n return self.__add__(other)\n def __repr__(self):\n return f\"Vector({self.x},{self.y})\"\n\ndef total(vectors):\n return sum(vectors, start=0)", "input": "total([Vector(1,2), Vector(3,4), Vector(-1,1)])", "language": "Python", "predicted_output": "Vector(3,7)"}}
{"submissionId": "cmssidxll00gkjmp2zacjhucf", "title": "Submission CJHUCF", "payload": {"code": "def merge_records(records):\n merged = {}\n for r in records:\n key = r[\"id\"]\n if key not in merged:\n merged[key] = {\"id\": key, \"tags\": set(), \"total\": 0}\n merged[key][\"tags\"].update(r.get(\"tags\", []))\n merged[key][\"total\"] += r.get(\"amount\", 0)\n return [\n {\"id\": k, \"tags\": sorted(v[\"tags\"]), \"total\": v[\"total\"]}\n for k, v in sorted(merged.items())\n ]", "input": "merge_records([{\"id\": 1, \"tags\": [\"a\",\"b\"], \"amount\": 10}, {\"id\": 2, \"tags\": [\"c\"], \"amount\": 5}, {\"id\": 1, \"tags\": [\"b\",\"d\"], \"amount\": 7}])", "language": "Python", "predicted_output": "[{'id': 1, 'tags': ['a', 'b', 'd'], 'total': 17}, {'id': 2, 'tags': ['c'], 'total': 5}]"}}
{"submissionId": "cmssidxll00gljmp2dp2unqxg", "title": "Submission 2UNQXG", "payload": {"code": "import heapq\nimport bisect\n\ndef k_smallest_and_rank(values, k, target):\n smallest = heapq.nsmallest(k, values)\n sorted_vals = sorted(values)\n rank = bisect.bisect_left(sorted_vals, target)\n return smallest, rank", "input": "k_smallest_and_rank([9, 3, 7, 1, 5, 2], 3, 5)", "language": "Python", "predicted_output": "([1, 2, 3], 3)"}}
{"submissionId": "cmssijdp000gmjmp2guwofbv0", "title": "Submission WOFBV0", "payload": {"code": "from dataclasses import dataclass, field\n\n@dataclass(frozen=True)\nclass Point:\n x: float\n y: float\n norm: float = field(init=False)\n\n def __post_init__(self):\n object.__setattr__(self, \"norm\", (self.x**2 + self.y**2) ** 0.5)\n\ndef make_and_try_mutate(x, y):\n p = Point(x, y)\n try:\n p.x = 100\n except Exception as e:\n return (p, type(e).__name__)\n return (p, None)", "input": "make_and_try_mutate(3, 4)", "language": "Python", "predicted_output": "(Point(x=3, y=4, norm=5.0), 'FrozenInstanceError')"}}
{"submissionId": "cmssijdp000gnjmp2ti0g2pr6", "title": "Submission 0G2PR6", "payload": {"code": "from enum import Enum\n\nclass Direction(Enum):\n NORTH = (0, 1)\n EAST = (1, 0)\n SOUTH = (0, -1)\n WEST = (-1, 0)\n\n def opposite(self):\n mapping = {\n Direction.NORTH: Direction.SOUTH,\n Direction.SOUTH: Direction.NORTH,\n Direction.EAST: Direction.WEST,\n Direction.WEST: Direction.EAST,\n }\n return mapping[self]\n\ndef describe(d):\n return (d.name, d.value, d.opposite().name)", "input": "describe(Direction.EAST)", "language": "Python", "predicted_output": "('EAST', (1, 0), 'WEST')"}}
{"submissionId": "cmssijdp000gojmp2copqdqq9", "title": "Submission PQDQQ9", "payload": {"code": "import contextvars\n\nctx_var = contextvars.ContextVar(\"ctx_var\", default=\"default\")\n\ndef show():\n return ctx_var.get()\n\ndef run():\n results = []\n results.append(show())\n token = ctx_var.set(\"outer\")\n results.append(show())\n ctx = contextvars.copy_context()\n def inner():\n ctx_var.set(\"inner\")\n return show()\n results.append(ctx.run(inner))\n results.append(show())\n ctx_var.reset(token)\n results.append(show())\n return results", "input": "run()", "language": "Python", "predicted_output": "['default', 'outer', 'inner', 'outer', 'default']"}}
{"submissionId": "cmssijdp000gpjmp2xddgd3py", "title": "Submission DGD3PY", "payload": {"code": "import weakref\n\nclass Widget:\n def __init__(self, name):\n self.name = name\n\ndef track():\n w = Widget(\"gadget\")\n ref = weakref.ref(w)\n alive_before = ref() is not None\n name_before = ref().name\n del w\n alive_after = ref() is not None\n return (alive_before, name_before, alive_after)", "input": "track()", "language": "Python", "predicted_output": "(True, 'gadget', False)"}}
{"submissionId": "cmssijdp000grjmp2a8sjpjdk", "title": "Submission SJPJDK", "payload": {"code": "from collections import deque\n\ndef process(items, maxlen):\n d = deque(items, maxlen=maxlen)\n d.rotate(2)\n d.append(99)\n d.rotate(-1)\n return list(d)", "input": "process([1,2,3,4,5], 4)", "language": "Python", "predicted_output": "[2, 3, 99, 5]"}}
{"submissionId": "cmssijdp000gtjmp2gzmmqdoo", "title": "Submission MMQDOO", "payload": {"code": "class A:\n def greet(self):\n return \"A\"\n\nclass B(A):\n def greet(self):\n return \"B->\" + super().greet()\n\nclass C(A):\n def greet(self):\n return \"C->\" + super().greet()\n\nclass D(B, C):\n def greet(self):\n return \"D->\" + super().greet()\n\ndef run():\n d = D()\n return (d.greet(), [c.__name__ for c in D.__mro__])", "input": "run()", "language": "Python", "predicted_output": "('D->B->C->A', ['D', 'B', 'C', 'A', 'object'])"}}
{"submissionId": "cmssijdp000gvjmp2mf4qt93p", "title": "Submission 4QT93P", "payload": {"code": "import itertools\n\ndef combine(a, b):\n chained = list(itertools.chain(a, b))\n it1, it2 = itertools.tee(chained, 2)\n first_two = [next(it1), next(it1)]\n all_from_it2 = list(it2)\n return (first_two, all_from_it2)", "input": "combine([1,2], [3,4,5])", "language": "Python", "predicted_output": "([1, 2], [1, 2, 3, 4, 5])"}}
{"submissionId": "cmssijdp000gyjmp21r1ijdf9", "title": "Submission 1IJDF9", "payload": {"code": "class Countdown:\n def __init__(self, start):\n self.start = start\n self.current = start\n\n def __iter__(self):\n return self\n\n def __next__(self):\n if self.current <= 0:\n raise StopIteration\n self.current -= 1\n return self.current + 1\n\ndef run(n):\n cd = Countdown(n)\n return list(cd) + list(cd)", "input": "run(3)", "language": "Python", "predicted_output": "[3, 2, 1]"}}
{"submissionId": "cmssijdp000gzjmp2ajjjg2ad", "title": "Submission JJG2AD", "payload": {"code": "def risky():\n try:\n raise ValueError(\"original\")\n finally:\n raise RuntimeError(\"from finally\")\n\ndef run():\n try:\n risky()\n except Exception as e:\n return (type(e).__name__, str(e))", "input": "run()", "language": "Python", "predicted_output": "('RuntimeError', 'from finally')"}}
{"submissionId": "cmssijdp000h0jmp2lajbx4c7", "title": "Submission JBX4C7", "payload": {"code": "def build_counts(words):\n counts_get = {}\n counts_setdefault = {}\n calls = []\n for w in words:\n counts_setdefault.setdefault(w, []).append(1)\n val = counts_get.get(w, [])\n val.append(1)\n counts_get[w] = val\n return (counts_setdefault, counts_get)", "input": "build_counts(['a','b','a','a'])", "language": "Python", "predicted_output": "({'a': [1, 1, 1], 'b': [1]}, {'a': [1, 1, 1], 'b': [1]})"}}
{"submissionId": "cmssijdp000h1jmp2ug8w4gr7", "title": "Submission 8W4GR7", "payload": {"code": "def stable_sort(records):\n return sorted(records, key=lambda r: r[0])", "input": "stable_sort([(1,'a'), (2,'b'), (1,'c'), (2,'d'), (1,'e')])", "language": "Python", "predicted_output": "[(1, 'a'), (1, 'c'), (1, 'e'), (2, 'b'), (2, 'd')]"}}
{"submissionId": "cmssijdp000h2jmp2l6zyvovj", "title": "Submission ZYVOVJ", "payload": {"code": "def roundtrip(s):\n encoded = s.encode('utf-8')\n b = bytearray(encoded)\n b[0] = ord('X') if b else 0\n try:\n decoded = bytes(b).decode('utf-8')\n except UnicodeDecodeError as e:\n decoded = f\"error: {e}\"\n return (encoded, decoded)", "input": "roundtrip('caf\u00e9')", "language": "Python", "predicted_output": "(b'caf\\xc3\\xa9', 'Xaf\u00e9')"}}
{"submissionId": "cmssijdp000h3jmp21yxf8xha", "title": "Submission XF8XHA", "payload": {"code": "def flatten(items, _seen=None):\n if _seen is None:\n _seen = set()\n result = []\n for item in items:\n if isinstance(item, list):\n result.extend(flatten(item, _seen))\n else:\n if id(item) not in _seen:\n _seen.add(id(item))\n result.append(item)\n return result\n\ndef run():\n first = flatten([1, [2, 3], [4, [5, 6]]])\n second = flatten([7, 8])\n return (first, second)", "input": "run()", "language": "Python", "predicted_output": "([1, 2, 3, 4, 5, 6], [7, 8])"}}
{"submissionId": "cmssijdp000h4jmp24fm31o51", "title": "Submission M31O51", "payload": {"code": "from functools import total_ordering\n\n@total_ordering\nclass Version:\n def __init__(self, major, minor):\n self.major = major\n self.minor = minor\n\n def __eq__(self, other):\n return (self.major, self.minor) == (other.major, other.minor)\n\n def __lt__(self, other):\n return (self.major, self.minor) < (other.major, other.minor)\n\n def __repr__(self):\n return f\"Version({self.major},{self.minor})\"\n\ndef compare(a, b):\n v1 = Version(*a)\n v2 = Version(*b)\n return (v1 < v2, v1 <= v2, v1 > v2, v1 >= v2, v1 == v2)", "input": "compare((1,5), (1,10))", "language": "Python", "predicted_output": "(True, True, False, False, False)"}}
{"submissionId": "cmssijdp000h5jmp2vcyy6170", "title": "Submission YY6170", "payload": {"code": "from itertools import zip_longest\n\ndef combine(a, b, c):\n short = list(zip(a, b, c))\n long_ = list(zip_longest(a, b, c, fillvalue=-1))\n return (short, long_)", "input": "combine([1,2,3], [4,5], [6,7,8,9])", "language": "Python", "predicted_output": "([(1, 4, 6), (2, 5, 7)], [(1, 4, 6), (2, 5, 7), (3, -1, 8), (-1, -1, 9)])"}}
{"submissionId": "cmssipppu00mgjmp2njviof6s", "title": "Submission VIOF6S", "payload": {"code": "def safe_double(x):\n try:\n return x * 2\n except TypeError:\n return None", "input": "safe_double(21)", "language": "Python", "predicted_output": "42"}}
{"submissionId": "cmssiq5hj00mmjmp234vuk15d", "title": "Submission VUK15D", "payload": {"code": "def fib_memo(n, memo=None):\n if memo is None:\n memo = {}\n if n in memo:\n return memo[n]\n if n <= 1:\n return n\n memo[n] = fib_memo(n - 1, memo) + fib_memo(n - 2, memo)\n return memo[n]", "input": "(fib_memo(10), fib_memo(7))", "language": "Python", "predicted_output": "(55, 13)"}}
{"submissionId": "cmssiqlto00mxjmp2mqoxfeli", "title": "Submission OXFELI", "payload": {"code": "def apply_counter_sequence(steps):\n count = 0\n def increment(step):\n nonlocal count\n count += step\n return count\n return [increment(s) for s in steps]", "input": "apply_counter_sequence([1, 2, 3])", "language": "Python", "predicted_output": "[1, 3, 6]"}}
{"submissionId": "cmssiqlto00myjmp2etkghbbm", "title": "Submission KGHBBM", "payload": {"code": "def flatten_unique(nested):\n seen = set()\n result = []\n for group in nested:\n for item in group:\n if item not in seen:\n seen.add(item)\n result.append(item)\n return result", "input": "flatten_unique([[1, 2, 2], [3, 1], [4]])", "language": "Python", "predicted_output": "[1, 2, 3, 4]"}}
{"submissionId": "cmssiqlto00mzjmp24r153bpu", "title": "Submission 153BPU", "payload": {"code": "def process(vals):\n results = []\n for v in vals:\n try:\n if v < 0:\n raise ValueError('negative')\n results.append(10 // v)\n except ZeroDivisionError:\n results.append(None)\n except ValueError:\n results.append(-1)\n finally:\n results.append('done')\n return results", "input": "process([2, 0, -1, 5])", "language": "Python", "predicted_output": "[5, 'done', None, 'done', -1, 'done', 2, 'done']"}}
{"submissionId": "cmssiqlto00n0jmp2l99k26ys", "title": "Submission 9K26YS", "payload": {"code": "def word_frequency_rank(text):\n freq = {}\n for word in text.split():\n freq[word] = freq.get(word, 0) + 1\n return sorted(freq.items(), key=lambda kv: (-kv[1], kv[0]))", "input": "word_frequency_rank('the cat sat on the mat the cat ran')", "language": "Python", "predicted_output": "[('the', 3), ('cat', 2), ('mat', 1), ('on', 1), ('ran', 1), ('sat', 1)]"}}
{"submissionId": "cmssiquuo00n1jmp244ptx9mm", "title": "Submission PTX9MM", "payload": {"code": "def rank_scores(entries):\n ordered = sorted(entries, key=lambda kv: (-kv[1], kv[0]))\n ranks = {}\n previous = None\n position = 0\n for index, (name, score) in enumerate(ordered, start=1):\n if score != previous:\n position = index\n previous = score\n ranks[name] = position\n return ranks", "input": "rank_scores([(\"ivy\", 70), (\"abe\", 90), (\"hal\", 70), (\"gus\", 90)])", "language": "Python", "predicted_output": "{'abe': 1, 'gus': 1, 'hal': 3, 'ivy': 3}"}}
{"submissionId": "cmssiquuo00n2jmp2533fu995", "title": "Submission 3FU995", "payload": {"code": "def resolve(values, key):\n log = []\n try:\n log.append(\"lookup\")\n return values[key]\n except KeyError:\n log.append(\"missing\")\n return None\n finally:\n log.append(\"cleanup\")\n if len(log) == 3:\n return tuple(log)", "input": "(resolve({\"a\": 1}, \"a\"), resolve({\"a\": 1}, \"z\"))", "language": "Python", "predicted_output": "(1, ('lookup', 'missing', 'cleanup'))"}}
{"submissionId": "cmssiquuo00n3jmp2oj6v04st", "title": "Submission 6V04ST", "payload": {"code": "import copy\n\ndef apply_patch(rows):\n shallow = rows.copy()\n deep = copy.deepcopy(rows)\n shallow[0].append(\"s\")\n deep[0].append(\"d\")\n shallow.append([\"new\"])\n return (rows, deep, len(shallow), len(rows))", "input": "apply_patch([[\"x\"], [\"y\"]])", "language": "Python", "predicted_output": "([['x', 's'], ['y']], [['x', 'd'], ['y']], 3, 2)"}}
{"submissionId": "cmssiquuo00n4jmp2y884dqan", "title": "Submission 84DQAN", "payload": {"code": "def summarize(readings):\n total = sum(readings)\n rounded = [round(value, 1) for value in readings]\n return {\n \"total\": total,\n \"rounded\": rounded,\n \"halves\": [round(value) for value in (0.5, 1.5, 2.5, 3.5)],\n \"exact\": total == 0.6,\n }", "input": "summarize([0.1, 0.2, 0.15, 0.25])", "language": "Python", "predicted_output": "{'total': 0.7, 'rounded': [0.1, 0.2, 0.1, 0.2], 'halves': [0, 2, 2, 4], 'exact': False}"}}
{"submissionId": "cmssiquuo00n5jmp2negnwm5u", "title": "Submission GNWM5U", "payload": {"code": "def collect(item, bucket=[]):\n bucket.append(item)\n return list(bucket)\n\ndef collect_safe(item, bucket=None):\n if bucket is None:\n bucket = []\n bucket.append(item)\n return bucket", "input": "(collect(\"a\"), collect(\"b\"), collect_safe(\"a\"), collect_safe(\"b\"))", "language": "Python", "predicted_output": "(['a'], ['a', 'b'], ['a'], ['b'])"}}
{"submissionId": "cmssis20b00nqjmp2wzy04ot3", "title": "Submission Y04OT3", "payload": {"code": "def count_chars(s):\n freq = {}\n for c in s:\n freq[c] = freq.get(c, 0) + 1\n return freq\n", "input": "count_chars('mississippi')", "language": "Python", "predicted_output": "{'m': 1, 'i': 4, 's': 4, 'p': 2}"}}
{"submissionId": "cmssis20b00nsjmp2pia73jk4", "title": "Submission A73JK4", "payload": {"code": "def pascal_row(n):\n row = [1]\n for i in range(1, n + 1):\n row.append(row[-1] * (n - i + 1) // i)\n return row\n", "input": "pascal_row(5)", "language": "Python", "predicted_output": "[1, 5, 10, 10, 5, 1]"}}
{"submissionId": "cmssis20b00ntjmp25n4rakt7", "title": "Submission 4RAKT7", "payload": {"code": "def chunk(lst, size):\n return [lst[i:i+size] for i in range(0, len(lst), size)]\n", "input": "chunk([1, 2, 3, 4, 5, 6, 7], 3)", "language": "Python", "predicted_output": "[[1, 2, 3], [4, 5, 6], [7]]"}}
{"submissionId": "cmssis20b00nujmp2ieotj4ib", "title": "Submission OTJ4IB", "payload": {"code": "def safe_div(a, b):\n try:\n return a / b\n except ZeroDivisionError:\n return None\n", "input": "(safe_div(10, 4), safe_div(7, 0))", "language": "Python", "predicted_output": "(2.5, None)"}}
{"submissionId": "cmssizqrl00pmjmp2vwp04cuz", "title": "Submission P04CUZ", "payload": {"code": "def running_sum(nums):\n total = 0\n result = []\n for n in nums:\n total += n\n result.append(total)\n return result\n", "input": "running_sum([1, 2, 3, 4, 5])", "language": "Python", "predicted_output": "[1, 3, 6, 10, 15]"}}
{"submissionId": "cmssjh8zb00qmjmp2629eulzl", "title": "Submission 9EULZL", "payload": {"code": "def rolling_windows(values, size):\n return [tuple(values[i:i+size]) for i in range(len(values)-size+1)]", "input": "rolling_windows([3, 1, 4, 1, 5], 3)", "language": "Python", "predicted_output": "[(3, 1, 4), (1, 4, 1), (4, 1, 5)]"}}
{"submissionId": "cmssjh8zb00qnjmp2hpkwrpc7", "title": "Submission KWRPC7", "payload": {"code": "def partition_stable(values, pivot):\n lower = [x for x in values if x < pivot]\n equal = [x for x in values if x == pivot]\n higher = [x for x in values if x > pivot]\n return lower + equal + higher", "input": "partition_stable([5, 2, 7, 2, 4, 2, 9], 2)", "language": "Python", "predicted_output": "[2, 2, 2, 5, 7, 4, 9]"}}
{"submissionId": "cmssjh8zb00qojmp2i54esuyd", "title": "Submission 4ESUYD", "payload": {"code": "def sparse_running_total(events):\n total = 0\n out = {}\n for key, delta in events:\n total += delta\n if total:\n out[key] = total\n return out", "input": "sparse_running_total([('a', 3), ('b', -3), ('c', 5), ('d', -2)])", "language": "Python", "predicted_output": "{'a': 3, 'c': 5, 'd': 3}"}}
{"submissionId": "cmssjh8zb00qpjmp2qcltvgor", "title": "Submission LTVGOR", "payload": {"code": "def rotate_layers(matrix):\n return [list(row) for row in zip(*matrix[::-1])]", "input": "rotate_layers([[1,2,3],[4,5,6],[7,8,9]])", "language": "Python", "predicted_output": "[[7, 4, 1], [8, 5, 2], [9, 6, 3]]"}}
{"submissionId": "cmssjh8zb00qqjmp2rw6y6c1p", "title": "Submission 6Y6C1P", "payload": {"code": "def merge_intervals(intervals):\n merged = []\n for start, end in sorted(intervals):\n if merged and start <= merged[-1][1] + 1:\n merged[-1] = (merged[-1][0], max(end, merged[-1][1]))\n else:\n merged.append((start, end))\n return merged", "input": "merge_intervals([(8,10),(1,3),(2,6),(12,12),(11,11)])", "language": "Python", "predicted_output": "[(1, 6), (8, 12)]"}}
{"submissionId": "cmssjh8zc00qrjmp2xa5trepm", "title": "Submission 5TREPM", "payload": {"code": "def diagonal_zigzag(grid):\n out = []\n rows, cols = len(grid), len(grid[0])\n for s in range(rows + cols - 1):\n part = [grid[r][s-r] for r in range(rows) if 0 <= s-r < cols]\n out.extend(part[::-1] if s % 2 == 0 else part)\n return out", "input": "diagonal_zigzag([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "[1, 2, 4, 5, 3, 6]"}}
{"submissionId": "cmssjh8zc00qsjmp2iha7p2ya", "title": "Submission A7P2YA", "payload": {"code": "def bounded_accumulate(values, low, high):\n total = 0\n out = []\n for value in values:\n total = min(high, max(low, total + value))\n out.append(total)\n return out", "input": "bounded_accumulate([4, 9, -3, -20, 8], -5, 10)", "language": "Python", "predicted_output": "[4, 10, 7, -5, 3]"}}
{"submissionId": "cmssjh8zc00qujmp22efm17q7", "title": "Submission FM17Q7", "payload": {"code": "def transpose_ragged(rows, fill=None):\n width = max(map(len, rows))\n return [[row[i] if i < len(row) else fill for row in rows] for i in range(width)]", "input": "transpose_ragged([[1,2,3],[4],[5,6]], 0)", "language": "Python", "predicted_output": "[[1, 4, 5], [2, 0, 6], [3, 0, 0]]"}}
{"submissionId": "cmssjh8zc00qvjmp2bob2cny3", "title": "Submission B2CNY3", "payload": {"code": "def local_peaks(values):\n return [(i, values[i]) for i in range(1, len(values)-1) if values[i] > values[i-1] and values[i] >= values[i+1]]", "input": "local_peaks([1,4,4,2,5,3,3])", "language": "Python", "predicted_output": "[(1, 4), (4, 5)]"}}
{"submissionId": "cmssjh8zc00qwjmp2bqjh66ge", "title": "Submission JH66GE", "payload": {"code": "from collections import Counter\ndef multiset_delta(left, right):\n a, b = Counter(left), Counter(right)\n return sorted((a-b).elements()), sorted((b-a).elements())", "input": "multiset_delta('mississippi', 'impossible')", "language": "Python", "predicted_output": "(['i', 'i', 'p', 's', 's'], ['b', 'e', 'l', 'o'])"}}
{"submissionId": "cmssjh8zc00qxjmp24nqrrwxt", "title": "Submission QRRWXT", "payload": {"code": "from collections import defaultdict\ndef invert_groups(mapping):\n out = defaultdict(list)\n for key, values in mapping.items():\n for value in values:\n out[value].append(key)\n return {k: sorted(v) for k, v in sorted(out.items())}", "input": "invert_groups({'red':['a','c'],'blue':['b','c'],'green':['a']})", "language": "Python", "predicted_output": "{'a': ['green', 'red'], 'b': ['blue'], 'c': ['blue', 'red']}"}}
{"submissionId": "cmssjh8zc00qyjmp24znkwkna", "title": "Submission NKWKNA", "payload": {"code": "from collections import deque\ndef consume_round_robin(queues):\n active = deque(deque(q) for q in queues if q)\n out = []\n while active:\n q = active.popleft()\n out.append(q.popleft())\n if q:\n active.append(q)\n return out", "input": "consume_round_robin([[1,2,3],['a'],[True,False]])", "language": "Python", "predicted_output": "[1, 'a', True, 2, False, 3]"}}
{"submissionId": "cmssjh8zc00qzjmp2nd57zo37", "title": "Submission 57ZO37", "payload": {"code": "import heapq\ndef scheduled_order(tasks):\n heap = [(time, priority, name) for name, time, priority in tasks]\n heapq.heapify(heap)\n return [heapq.heappop(heap)[2] for _ in range(len(heap))]", "input": "scheduled_order([('backup',5,2),('alert',2,1),('sync',5,1),('index',2,3)])", "language": "Python", "predicted_output": "['alert', 'index', 'sync', 'backup']"}}
{"submissionId": "cmssjh8zc00r0jmp2f2gjfekf", "title": "Submission GJFEKF", "payload": {"code": "import bisect\ndef insert_and_rank(sorted_values, additions):\n values = list(sorted_values)\n ranks = []\n for x in additions:\n i = bisect.bisect_right(values, x)\n values.insert(i, x)\n ranks.append(i)\n return values, ranks", "input": "insert_and_rank([1,3,3,8], [3,0,10])", "language": "Python", "predicted_output": "([0, 1, 3, 3, 3, 8, 10], [3, 0, 6])"}}
{"submissionId": "cmssjh8zc00r1jmp2fe8qcdsq", "title": "Submission 8QCDSQ", "payload": {"code": "from itertools import groupby\ndef summarize_signs(values):\n key = lambda x: 'pos' if x > 0 else ('neg' if x < 0 else 'zero')\n return [(k, sum(1 for _ in g)) for k, g in groupby(values, key)]", "input": "summarize_signs([2,1,0,0,-1,-3,4,-2])", "language": "Python", "predicted_output": "[('pos', 2), ('zero', 2), ('neg', 2), ('pos', 1), ('neg', 1)]"}}
{"submissionId": "cmssjh8zc00r2jmp2pngnujz5", "title": "Submission GNUJZ5", "payload": {"code": "from itertools import accumulate\ndef prefix_extrema(values):\n return list(accumulate(values, max)), list(accumulate(values, min))", "input": "prefix_extrema([5,2,8,1,7])", "language": "Python", "predicted_output": "([5, 5, 8, 8, 8], [5, 2, 2, 1, 1])"}}
{"submissionId": "cmssjh8zc00r3jmp2uqyvuenq", "title": "Submission YVUENQ", "payload": {"code": "from functools import reduce\ndef compose_steps(value, steps):\n return reduce(lambda current, step: step(current), steps, value)", "input": "compose_steps(3, [lambda x:x+4, lambda x:x*x, lambda x:x-5])", "language": "Python", "predicted_output": "44"}}
{"submissionId": "cmssjh8zc00r4jmp283mywie9", "title": "Submission MYWIE9", "payload": {"code": "def dictionary_diff(before, after):\n keys = before.keys() | after.keys()\n return {k:(before.get(k), after.get(k)) for k in sorted(keys) if before.get(k) != after.get(k)}", "input": "dictionary_diff({'a':1,'b':2,'d':None}, {'b':3,'c':4,'d':None})", "language": "Python", "predicted_output": "{'a': (1, None), 'b': (2, 3), 'c': (None, 4)}"}}
{"submissionId": "cmssjh8zc00r5jmp2x6ne579h", "title": "Submission NE579H", "payload": {"code": "def nested_get(data, path, default=None):\n cur = data\n for part in path:\n try:\n cur = cur[part]\n except (KeyError, IndexError, TypeError):\n return default\n return cur", "input": "(nested_get({'a':[{'b':7}]}, ['a',0,'b']), nested_get({'a':[]}, ['a',1], 'missing'))", "language": "Python", "predicted_output": "(7, 'missing')"}}
{"submissionId": "cmssjh8zc00r6jmp2zvxxweah", "title": "Submission XXWEAH", "payload": {"code": "def parse_pairs(parts):\n out = {}\n errors = []\n for part in parts:\n try:\n key, raw = part.split('=', 1)\n out[key] = int(raw)\n except ValueError:\n errors.append(part)\n return out, errors", "input": "parse_pairs(['x=4','bad','y=-2','z=3.5','note=a=b'])", "language": "Python", "predicted_output": "({'x': 4, 'y': -2}, ['bad', 'z=3.5', 'note=a=b'])"}}
{"submissionId": "cmssjh8zc00r7jmp2vkaolese", "title": "Submission AOLESE", "payload": {"code": "def guarded_index(values, indexes):\n out = []\n for index in indexes:\n try:\n out.append(values[index])\n except IndexError:\n out.append('out')\n else:\n out[-1] = (index, out[-1])\n return out", "input": "guarded_index(['a','b','c'], [0,-1,3,-4])", "language": "Python", "predicted_output": "[(0, 'a'), (-1, 'c'), 'out', 'out']"}}
{"submissionId": "cmssjh8zc00r8jmp2hiz10895", "title": "Submission Z10895", "payload": {"code": "def exception_chain(flag):\n try:\n if flag:\n raise KeyError('root')\n return 'ok'\n except KeyError as exc:\n try:\n raise RuntimeError('wrapped') from exc\n except RuntimeError as wrapped:\n return type(wrapped.__cause__).__name__, str(wrapped)\n finally:\n flag = None", "input": "(exception_chain(False), exception_chain(True))", "language": "Python", "predicted_output": "('ok', ('KeyError', 'wrapped'))"}}
{"submissionId": "cmssjh8zc00r9jmp22a2fys68", "title": "Submission 2FYS68", "payload": {"code": "def transactional_update(state, operations):\n original = state.copy()\n try:\n for key, delta in operations:\n state[key] += delta\n if state[key] < 0:\n raise ValueError(key)\n except (KeyError, ValueError) as exc:\n state.clear(); state.update(original)\n return False, str(exc), state\n return True, None, state", "input": "transactional_update({'cash':5,'stock':2}, [('cash',-3),('stock',-4)])", "language": "Python", "predicted_output": "(False, 'stock', {'cash': 5, 'stock': 2})"}}
{"submissionId": "cmssjh8zc00rajmp217t8kk8d", "title": "Submission T8KK8D", "payload": {"code": "def finally_override(value):\n try:\n return 10 // value\n except ZeroDivisionError:\n return 'zero'\n finally:\n if value < 0:\n return 'negative' ", "input": "(finally_override(2), finally_override(0), finally_override(-2))", "language": "Python", "predicted_output": "(5, 'zero', 'negative')"}}
{"submissionId": "cmssjh8zc00rbjmp2oj9jvk1a", "title": "Submission 9JVK1A", "payload": {"code": "class Ledger:\n def __init__(self): self.entries = []\n def add(self, amount): self.entries.append(amount); return self\n @property\n def balance(self): return sum(self.entries)\n def __repr__(self): return f'Ledger({self.entries!r}, balance={self.balance})' ", "input": "Ledger().add(10).add(-3).add(5)", "language": "Python", "predicted_output": "Ledger([10, -3, 5], balance=12)"}}
{"submissionId": "cmssjh8zc00rcjmp2f3lshcjl", "title": "Submission LSHCJL", "payload": {"code": "class Temperature:\n def __init__(self, c): self.c = c\n def __lt__(self, other): return self.c < other.c\n def __repr__(self): return f'{self.c}C'\ndef temperature_bounds(values):\n temps = [Temperature(v) for v in values]\n return min(temps), max(temps)", "input": "temperature_bounds([12,-4,31,12])", "language": "Python", "predicted_output": "(-4C, 31C)"}}
{"submissionId": "cmssjh8zc00rdjmp2r3unp2u7", "title": "Submission UNP2U7", "payload": {"code": "class CounterBox:\n def __init__(self, start): self.value = start\n def __enter__(self): self.value += 1; return self\n def __exit__(self, kind, exc, tb): self.value *= 2\ndef use_box(start):\n with CounterBox(start) as box:\n box.value += 3\n return box.value", "input": "use_box(4)", "language": "Python", "predicted_output": "16"}}
{"submissionId": "cmssjh8zc00rejmp22rqhmoxn", "title": "Submission QHMOXN", "payload": {"code": "class Node:\n def __init__(self, value, children=()): self.value, self.children = value, children\n def __iter__(self):\n yield self.value\n for child in self.children:\n yield from child\ndef tree_values():\n return list(Node('a',(Node('b'),Node('c',(Node('d'),)))))", "input": "tree_values()", "language": "Python", "predicted_output": "['a', 'b', 'c', 'd']"}}
{"submissionId": "cmssjh8zc00rfjmp2qvi46etn", "title": "Submission I46ETN", "payload": {"code": "class Descriptor:\n def __set_name__(self, owner, name): self.name = '_' + name\n def __get__(self, obj, owner): return getattr(obj, self.name, 0)\n def __set__(self, obj, value): setattr(obj, self.name, max(0, value))\nclass Meter:\n reading = Descriptor()\n def __init__(self, value): self.reading = value", "input": "(Meter(-3).reading, Meter(8).reading)", "language": "Python", "predicted_output": "(0, 8)"}}
{"submissionId": "cmssjh8zc00rgjmp2w56850dh", "title": "Submission 6850DH", "payload": {"code": "class Base:\n def label(self): return 'base'\nclass Left(Base):\n def label(self): return 'left>' + super().label()\nclass Right(Base):\n def label(self): return 'right>' + super().label()\nclass Combined(Left, Right): pass", "input": "(Combined().label(), [c.__name__ for c in Combined.__mro__])", "language": "Python", "predicted_output": "('left>right>base', ['Combined', 'Left', 'Right', 'Base', 'object'])"}}
{"submissionId": "cmssjh8zc00rhjmp2t4smx4ao", "title": "Submission SMX4AO", "payload": {"code": "from dataclasses import dataclass, replace\n@dataclass(order=True, frozen=True)\nclass Job:\n priority: int\n name: str\ndef reprioritize(jobs):\n changed = [replace(j, priority=j.priority-1) if j.name.startswith('u') else j for j in jobs]\n return sorted(changed)", "input": "reprioritize([Job(3,'upload'),Job(1,'audit'),Job(2,'update')])", "language": "Python", "predicted_output": "[Job(priority=1, name='audit'), Job(priority=1, name='update'), Job(priority=2, name='upload')]"}}
{"submissionId": "cmssjh8zc00rijmp2y9tpbk4c", "title": "Submission TPBK4C", "payload": {"code": "from enum import IntFlag\nclass Access(IntFlag):\n READ=1; WRITE=2; EXECUTE=4\ndef permissions(value):\n mask = Access(value)\n return bool(mask & Access.WRITE), (mask | Access.EXECUTE).value, (mask & ~Access.READ).value", "input": "permissions(3)", "language": "Python", "predicted_output": "(True, 7, 2)"}}
{"submissionId": "cmssjh8zc00rjjmp2wf58k1f4", "title": "Submission 58K1F4", "payload": {"code": "def coroutine_trace(values):\n def running():\n total = 0\n while True:\n value = yield total\n total += value\n g = running(); out = [next(g)]\n out.extend(g.send(v) for v in values)\n return out", "input": "coroutine_trace([3,-1,5])", "language": "Python", "predicted_output": "[0, 3, 2, 7]"}}
{"submissionId": "cmssjh8zc00rkjmp22fotbkti", "title": "Submission OTBKTI", "payload": {"code": "def generator_cleanup(limit):\n log = []\n def gen():\n try:\n for i in range(limit): yield i\n finally: log.append('closed')\n g = gen(); first = next(g); g.close()\n return first, log", "input": "generator_cleanup(4)", "language": "Python", "predicted_output": "(0, ['closed'])"}}
{"submissionId": "cmssjh8zc00rljmp2y0g45t1q", "title": "Submission G45T1Q", "payload": {"code": "from contextlib import contextmanager\n@contextmanager\ndef tagged(log, name):\n log.append('enter:'+name)\n try: yield name.upper()\n finally: log.append('exit:'+name)\ndef nested_tags():\n log=[]\n with tagged(log,'a') as a, tagged(log,'b') as b: log.append(a+b)\n return log", "input": "nested_tags()", "language": "Python", "predicted_output": "['enter:a', 'enter:b', 'AB', 'exit:b', 'exit:a']"}}
{"submissionId": "cmssjh8zc00rmjmp2i1qcwazm", "title": "Submission QCWAZM", "payload": {"code": "from decimal import Decimal, ROUND_HALF_UP\ndef invoice_total(prices, tax):\n subtotal = sum(map(Decimal, prices))\n total = subtotal * (Decimal('1') + Decimal(tax))\n return subtotal, total.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)", "input": "invoice_total(['1.005','2.335','10.00'], '0.075')", "language": "Python", "predicted_output": "(Decimal('13.340'), Decimal('14.34'))"}}
{"submissionId": "cmssjh8zc00rojmp2oxip35pt", "title": "Submission IP35PT", "payload": {"code": "from datetime import datetime, timedelta, timezone\ndef timeline(start, offsets):\n base = datetime.fromisoformat(start).astimezone(timezone.utc)\n return [(base + timedelta(minutes=m)).isoformat() for m in offsets]", "input": "timeline('2026-08-01T23:50:00+05:30', [0,20,75])", "language": "Python", "predicted_output": "['2026-08-01T18:20:00+00:00', '2026-08-01T18:40:00+00:00', '2026-08-01T19:35:00+00:00']"}}
{"submissionId": "cmssjh8zc00rpjmp23hazpxud", "title": "Submission AZPXUD", "payload": {"code": "from pathlib import PurePosixPath\ndef path_summary(paths):\n ps = [PurePosixPath(p) for p in paths]\n return [(p.name, p.suffix, len(p.parts)) for p in ps]", "input": "path_summary(['/srv/app/main.py','docs/archive.tar.gz','README'])", "language": "Python", "predicted_output": "[('main.py', '.py', 4), ('archive.tar.gz', '.gz', 2), ('README', '', 1)]"}}
{"submissionId": "cmssjh8zc00rqjmp2g7uruy98", "title": "Submission URUY98", "payload": {"code": "import re\ndef capture_report(text):\n pattern = re.compile(r'(?P<key>[A-Z]+)=(?P<value>\\d+)')\n return [(m.group('key'), int(m.group('value')), m.span()) for m in pattern.finditer(text)]", "input": "capture_report('CPU=81 MEM=64 note CPU=90')", "language": "Python", "predicted_output": "[('CPU', 81, (0, 6)), ('MEM', 64, (7, 13)), ('CPU', 90, (19, 25))]"}}
{"submissionId": "cmssjh8zc00rsjmp2e5k2ffej", "title": "Submission K2FFEJ", "payload": {"code": "import statistics\ndef robust_summary(values):\n q = statistics.quantiles(values, n=4, method='inclusive')\n return statistics.median(values), q[0], q[2], round(statistics.pstdev(values), 3)", "input": "robust_summary([2,4,4,4,5,5,7,9])", "language": "Python", "predicted_output": "(4.5, 4.0, 5.5, 2.0)"}}
{"submissionId": "cmssjh8zc00rtjmp2f5lv1qvt", "title": "Submission LV1QVT", "payload": {"code": "import math\ndef floating_edges(values):\n return [(math.isfinite(x), math.copysign(1.0,x), round(x,2)) for x in values]", "input": "floating_edges([0.0,-0.0,2.675,float('inf')])", "language": "Python", "predicted_output": "[(True, 1.0, 0.0), (True, -1.0, -0.0), (True, 1.0, 2.67), (False, 1.0, inf)]"}}
{"submissionId": "cmssjh8zc00rujmp22pl5i7xj", "title": "Submission L5I7XJ", "payload": {"code": "import string\ndef translation_map(text):\n table = str.maketrans({'-':' ', '_':' ', '!':None})\n cleaned = text.translate(table)\n return cleaned, string.capwords(cleaned)", "input": "translation_map('hello-world_test!')", "language": "Python", "predicted_output": "('hello world test', 'Hello World Test')"}}
{"submissionId": "cmssjh8zc00rvjmp2plwb2vf7", "title": "Submission WB2VF7", "payload": {"code": "from operator import itemgetter\ndef ranked_rows(rows):\n ordered = sorted(rows, key=itemgetter(1,0), reverse=True)\n return [(i+1, row) for i,row in enumerate(ordered)]", "input": "ranked_rows([('amy',3),('bob',5),('cid',5),('dee',2)])", "language": "Python", "predicted_output": "[(1, ('cid', 5)), (2, ('bob', 5)), (3, ('amy', 3)), (4, ('dee', 2))]"}}
{"submissionId": "cmssjh8zc00rwjmp2mt3osc79", "title": "Submission 3OSC79", "payload": {"code": "def memoized_paths(n):\n cache = {0:1, 1:1}\n def count(k):\n if k not in cache: cache[k] = count(k-1) + count(k-2)\n return cache[k]\n value = count(n)\n return value, sorted(cache.items())", "input": "memoized_paths(6)", "language": "Python", "predicted_output": "(13, [(0, 1), (1, 1), (2, 2), (3, 3), (4, 5), (5, 8), (6, 13)])"}}
{"submissionId": "cmssjh8zc00rxjmp2bwtdakip", "title": "Submission TDAKIP", "payload": {"code": "def closure_cells(start):\n value = start\n def get(): return value\n def bump(delta):\n nonlocal value\n value += delta\n return value\n return get, bump", "input": "(lambda pair: (pair[0](), pair[1](4), pair[0](), pair[1](-2)))(closure_cells(3))", "language": "Python", "predicted_output": "(3, 7, 7, 5)"}}
{"submissionId": "cmssjh8zc00ryjmp2zwnw9e23", "title": "Submission NW9E23", "payload": {"code": "def match_records(records):\n out=[]\n for record in records:\n match record:\n case {'kind':'point','x':x,'y':y}: out.append(x+y)\n case [head,*tail]: out.append((head,len(tail)))\n case _: out.append(None)\n return out", "input": "match_records([{'kind':'point','x':2,'y':5}, [9,8,7], {'kind':'other'}])", "language": "Python", "predicted_output": "[7, (9, 2), None]"}}
{"submissionId": "cmssjh8zc00rzjmp2rt4ghjcv", "title": "Submission 4GHJCV", "payload": {"code": "def walrus_chunks(values, size):\n it = iter(values)\n out=[]\n while chunk := tuple(next(it, None) for _ in range(size)):\n clean = tuple(x for x in chunk if x is not None)\n if not clean: break\n out.append(clean)\n if len(clean) < size: break\n return out", "input": "walrus_chunks([1,2,3,4,5], 2)", "language": "Python", "predicted_output": "[(1, 2), (3, 4), (5,)]"}}
{"submissionId": "cmssjklaf00s5jmp2tz8iq3af", "title": "Submission 8IQ3AF", "payload": {"code": "def collect(value, bucket=[]):\n bucket.append(value)\n return list(bucket)\n\ndef run_three():\n return [collect(1), collect(2), collect(3)]", "input": "run_three()", "language": "Python", "predicted_output": "[[1], [1, 2], [1, 2, 3]]"}}
{"submissionId": "cmssjklaf00s6jmp2x4gbp1up", "title": "Submission GBP1UP", "payload": {"code": "def make_multipliers():\n fns = []\n for factor in range(1, 4):\n fns.append(lambda x: x * factor)\n return fns\n\ndef apply_all(x):\n return [f(x) for f in make_multipliers()]", "input": "apply_all(5)", "language": "Python", "predicted_output": "[15, 15, 15]"}}
{"submissionId": "cmssjklag00s7jmp2gcrvq66h", "title": "Submission RVQ66H", "payload": {"code": "log = []\n\ndef tagged(items):\n for it in items:\n log.append(it)\n yield it * 2\n\ndef peek_then_log():\n gen = tagged([1, 2, 3])\n first = next(gen)\n snapshot = list(log)\n rest = list(gen)\n return [first, snapshot, rest, list(log)]", "input": "peek_then_log()", "language": "Python", "predicted_output": "[2, [1], [4, 6], [1, 2, 3]]"}}
{"submissionId": "cmssjklag00s8jmp2cgsc5tds", "title": "Submission SC5TDS", "payload": {"code": "def pair_up(n):\n it = iter(range(n))\n return list(zip(it, it))", "input": "pair_up(7)", "language": "Python", "predicted_output": "[(0, 1), (2, 3), (4, 5)]"}}
{"submissionId": "cmssjklag00s9jmp2bxzmd1gd", "title": "Submission ZMD1GD", "payload": {"code": "def merge_order():\n d = {\"a\": 1, \"b\": 2, \"c\": 3}\n d[\"a\"] = 99\n del d[\"b\"]\n d[\"b\"] = 5\n return list(d.items())", "input": "merge_order()", "language": "Python", "predicted_output": "[('a', 99), ('c', 3), ('b', 5)]"}}
{"submissionId": "cmssjklag00sajmp26uoyx0vk", "title": "Submission OYX0VK", "payload": {"code": "def by_length(words):\n return sorted(words, key=len)", "input": "by_length(['pear', 'fig', 'plum', 'kiwi', 'date'])", "language": "Python", "predicted_output": "['fig', 'pear', 'plum', 'kiwi', 'date']"}}
{"submissionId": "cmssjklag00sbjmp27ozveyy4", "title": "Submission ZVEYY4", "payload": {"code": "class Basket:\n contents = []\n\n def __init__(self, name):\n self.name = name\n\n def add(self, item):\n self.contents.append(item)\n return len(self.contents)\n\ndef shared_state():\n a, b = Basket(\"a\"), Basket(\"b\")\n first = a.add(\"x\")\n second = b.add(\"y\")\n return [first, second, a.contents, b.contents is a.contents]", "input": "shared_state()", "language": "Python", "predicted_output": "[1, 2, ['x', 'y'], True]"}}
{"submissionId": "cmssjklag00scjmp26ehbsxhb", "title": "Submission HBSXHB", "payload": {"code": "class Base:\n def trace(self):\n return [\"Base\"]\n\nclass Left(Base):\n def trace(self):\n return [\"Left\"] + super().trace()\n\nclass Right(Base):\n def trace(self):\n return [\"Right\"] + super().trace()\n\nclass Bottom(Left, Right):\n def trace(self):\n return [\"Bottom\"] + super().trace()", "input": "Bottom().trace()", "language": "Python", "predicted_output": "['Bottom', 'Left', 'Right', 'Base']"}}
{"submissionId": "cmssjklag00sdjmp2lx9uo4pw", "title": "Submission 9UO4PW", "payload": {"code": "def which_wins():\n try:\n return \"try\"\n finally:\n return \"finally\"\n\ndef probe():\n return [which_wins()]", "input": "probe()", "language": "Python", "predicted_output": "['finally']"}}
{"submissionId": "cmssjklag00sejmp2me6l7wmq", "title": "Submission 6L7WMQ", "payload": {"code": "def stripe(n):\n xs = list(range(n))\n xs[::2] = [0] * len(xs[::2])\n return xs", "input": "stripe(7)", "language": "Python", "predicted_output": "[0, 1, 0, 3, 0, 5, 0]"}}
{"submissionId": "cmssjklag00sfjmp2zkiotfvy", "title": "Submission IOTFVY", "payload": {"code": "def divmods(pairs):\n return [(a // b, a % b) for a, b in pairs]", "input": "divmods([(7, 3), (-7, 3), (7, -3), (-7, -3)])", "language": "Python", "predicted_output": "[(2, 1), (-3, 2), (-3, -2), (2, -1)]"}}
{"submissionId": "cmssjklag00sgjmp2mni5c6j1", "title": "Submission I5C6J1", "payload": {"code": "def tokens(text):\n return [text.split(), text.split(\" \")]", "input": "tokens(' a b ')", "language": "Python", "predicted_output": "[['a', 'b'], ['', '', 'a', '', 'b', '']]"}}
{"submissionId": "cmssjklag00shjmp2hsjy0ff9", "title": "Submission JY0FF9", "payload": {"code": "def squares_over(nums, floor):\n return [sq for n in nums if (sq := n * n) > floor]", "input": "squares_over([1, 3, 5, 2, 7], 8)", "language": "Python", "predicted_output": "[9, 25, 49]"}}
{"submissionId": "cmssjklag00sijmp2mqjmrm0f", "title": "Submission JMRM0F", "payload": {"code": "def counted(fn):\n calls = {\"n\": 0}\n\n def wrapper(*args):\n calls[\"n\"] += 1\n return (calls[\"n\"], fn(*args))\n\n return wrapper\n\n@counted\ndef double(x):\n return x * 2\n\ndef three_calls():\n return [double(1), double(2), double(3)]", "input": "three_calls()", "language": "Python", "predicted_output": "[(1, 2), (2, 4), (3, 6)]"}}
{"submissionId": "cmssjklag00sjjmp23lkmqo42", "title": "Submission KMQO42", "payload": {"code": "def key_collisions():\n d = {}\n d[1] = \"int\"\n d[True] = \"bool\"\n d[1.0] = \"float\"\n return [len(d), list(d.keys()), d[1]]", "input": "key_collisions()", "language": "Python", "predicted_output": "[1, [1], 'float']"}}
{"submissionId": "cmssjklag00skjmp2njd5uyy7", "title": "Submission D5UYY7", "payload": {"code": "import copy\n\ndef shallow_vs_deep():\n original = [[1, 2], [3, 4]]\n shallow = copy.copy(original)\n deep = copy.deepcopy(original)\n original[0].append(99)\n return [shallow, deep]", "input": "shallow_vs_deep()", "language": "Python", "predicted_output": "[[[1, 2, 99], [3, 4]], [[1, 2], [3, 4]]]"}}
{"submissionId": "cmssjklag00sljmp2pjh64lsy", "title": "Submission H64LSY", "payload": {"code": "def risky(items):\n for it in items:\n if it == 0:\n raise ValueError(\"zero\")\n yield 10 // it\n\ndef collect_until_error(items):\n out = []\n try:\n for v in risky(items):\n out.append(v)\n except ValueError as e:\n out.append(str(e))\n return out", "input": "collect_until_error([5, 2, 0, 1])", "language": "Python", "predicted_output": "[2, 5, 'zero']"}}
{"submissionId": "cmssjklag00smjmp23qegpoe5", "title": "Submission EGPOE5", "payload": {"code": "from functools import reduce\n\ndef fold(nums):\n with_init = reduce(lambda a, b: a * 10 + b, nums, 0)\n without = reduce(lambda a, b: a * 10 + b, nums)\n return [with_init, without]", "input": "fold([1, 2, 3])", "language": "Python", "predicted_output": "[123, 123]"}}
{"submissionId": "cmssjklag00snjmp2d492nz8f", "title": "Submission 92NZ8F", "payload": {"code": "def fib(n, memo={}):\n if n < 2:\n return n\n if n not in memo:\n memo[n] = fib(n - 1, memo) + fib(n - 2, memo)\n return memo[n]\n\ndef two_rounds():\n first = fib(10)\n size_after = len(fib.__defaults__[0])\n return [first, size_after]", "input": "two_rounds()", "language": "Python", "predicted_output": "[55, 9]"}}
{"submissionId": "cmssjklag00sojmp2h6tklasp", "title": "Submission TKLASP", "payload": {"code": "from itertools import groupby\n\ndef group_parity(nums):\n key = lambda n: n % 2\n unsorted = [(k, list(g)) for k, g in groupby(nums, key)]\n presorted = [(k, list(g)) for k, g in groupby(sorted(nums, key=key), key)]\n return [len(unsorted), unsorted, presorted]", "input": "group_parity([1, 3, 2, 4, 5])", "language": "Python", "predicted_output": "[3, [(1, [1, 3]), (0, [2, 4]), (1, [5])], [(0, [2, 4]), (1, [1, 3, 5])]]"}}
{"submissionId": "cmsskjlzb0126jmp2fhk3lz6b", "title": "Submission K3LZ6B", "payload": {"code": "def accumulate(value, bucket=[]):\n bucket.append(value)\n return bucket", "input": "(accumulate(1), accumulate(2), accumulate(3))", "language": "Python", "predicted_output": "([1, 2, 3], [1, 2, 3], [1, 2, 3])"}}
{"submissionId": "cmsskjlzc0127jmp25kgok4vn", "title": "Submission GOK4VN", "payload": {"code": "def safe_divide_chain(pairs):\n results = []\n for a, b in pairs:\n try:\n r = a / b\n except ZeroDivisionError:\n results.append(None)\n else:\n results.append(round(r, 2))\n finally:\n results.append('checked')\n return results", "input": "safe_divide_chain([(10, 2), (5, 0), (7, 3)])", "language": "Python", "predicted_output": "[5.0, 'checked', None, 'checked', 2.33, 'checked']"}}
{"submissionId": "cmsskjlzc0128jmp2zndg4hge", "title": "Submission DG4HGE", "payload": {"code": "import itertools\n\ndef group_consecutive(items):\n return [(k, list(v)) for k, v in itertools.groupby(items)]", "input": "group_consecutive([1, 1, 2, 1, 1, 3, 3])", "language": "Python", "predicted_output": "[(1, [1, 1]), (2, [2]), (1, [1, 1]), (3, [3, 3])]"}}
{"submissionId": "cmsskw28m013qjmp20zfisbjv", "title": "Submission FISBJV", "payload": {"code": "def transform(nums):\n reversed_evens = [n for n in nums[::-1] if n % 2 == 0]\n return reversed_evens[1:-1]", "input": "transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])", "language": "Python", "predicted_output": "[8, 6, 4]"}}
{"submissionId": "cmsskw28m013rjmp252fcmg1i", "title": "Submission FCMG1I", "payload": {"code": "def classify_matrix(matrix):\n return [\n [\"pos\" if val > 0 else \"neg\" if val < 0 else \"zero\" for val in row]\n for row in matrix\n ]", "input": "classify_matrix([[1, -2, 0], [-5, 5, 0]])", "language": "Python", "predicted_output": "[['pos', 'neg', 'zero'], ['neg', 'pos', 'zero']]"}}
{"submissionId": "cmsskw28m013sjmp2bzsfewa9", "title": "Submission SFEWA9", "payload": {"code": "def index_map(names, scores):\n return {\n i: (name, score)\n for i, (name, score) in enumerate(zip(names, scores))\n if score >= 50\n }", "input": "index_map([\"Ann\", \"Bob\", \"Cy\"], [40, 60, 75])", "language": "Python", "predicted_output": "{1: ('Bob', 60), 2: ('Cy', 75)}"}}
{"submissionId": "cmsskw28m013ujmp2kn6h803o", "title": "Submission 6H803O", "payload": {"code": "from itertools import islice\n\ndef counter_gen(start, step):\n n = start\n while True:\n yield n\n n += step\n\ndef take_n(start, step, n):\n return list(islice(counter_gen(start, step), n))", "input": "take_n(3, 5, 4)", "language": "Python", "predicted_output": "[3, 8, 13, 18]"}}
{"submissionId": "cmsskw28m013vjmp2qnmte7yb", "title": "Submission MTE7YB", "payload": {"code": "def rank_students(students):\n return sorted(students, key=lambda s: (-s[1], s[2]))", "input": "rank_students([(\"Ann\", 85, 20), (\"Bob\", 90, 19), (\"Cy\", 85, 18), (\"Dee\", 90, 21)])", "language": "Python", "predicted_output": "[('Bob', 90, 19), ('Dee', 90, 21), ('Cy', 85, 18), ('Ann', 85, 20)]"}}
{"submissionId": "cmsskw28m013wjmp2dzj2iifh", "title": "Submission J2IIFH", "payload": {"code": "def format_prices(prices):\n return [f\"{p:.2f}\" for p in prices]", "input": "format_prices([1.005, 2.675, 0.1 + 0.2, 10])", "language": "Python", "predicted_output": "['1.00', '2.67', '0.30', '10.00']"}}
{"submissionId": "cmsskw28m013xjmp2n9vevf6e", "title": "Submission VEVF6E", "payload": {"code": "def compare_groups(a, b):\n set_a = set(a)\n set_b = set(b)\n return {\n \"only_a\": sorted(set_a - set_b),\n \"only_b\": sorted(set_b - set_a),\n \"common\": sorted(set_a & set_b),\n \"symmetric\": sorted(set_a ^ set_b),\n }", "input": "compare_groups([1, 2, 3, 4, 2], [3, 4, 5, 6])", "language": "Python", "predicted_output": "{'only_a': [1, 2], 'only_b': [5, 6], 'common': [3, 4], 'symmetric': [1, 2, 5, 6]}"}}
{"submissionId": "cmsskw28m013yjmp2e4praimr", "title": "Submission PRAIMR", "payload": {"code": "from functools import lru_cache\n\n@lru_cache(maxsize=None)\ndef collatz_steps(n):\n if n == 1:\n return 0\n if n % 2 == 0:\n return 1 + collatz_steps(n // 2)\n return 1 + collatz_steps(3 * n + 1)\n\ndef total_steps(nums):\n return sum(collatz_steps(n) for n in nums)", "input": "total_steps([6, 7, 27])", "language": "Python", "predicted_output": "135"}}
{"submissionId": "cmsskw28m013zjmp26ggvjuza", "title": "Submission GVJUZA", "payload": {"code": "from collections import Counter\n\ndef top_words(text, n):\n words = text.lower().split()\n counts = Counter(words)\n return counts.most_common(n)", "input": "top_words(\"dog cat bird cat bird dog cat bird bird fish\", 3)", "language": "Python", "predicted_output": "[('bird', 4), ('cat', 3), ('dog', 2)]"}}
{"submissionId": "cmssl291o014zjmp2spo9f1b8", "title": "Submission O9F1B8", "payload": {"code": "def append_item(item, bucket=[]):\n bucket.append(item)\n return bucket\n", "input": "(append_item(1), append_item(2), append_item(3, []))", "language": "Python", "predicted_output": "([1, 2], [1, 2], [3])"}}
{"submissionId": "cmssl291o0150jmp2lctu60c9", "title": "Submission TU60C9", "payload": {"code": "def counter(n):\n for i in range(n):\n yield i * i\n\ndef drain_twice(n):\n g = counter(n)\n first = list(g)\n second = list(g)\n return (first, second)\n", "input": "drain_twice(4)", "language": "Python", "predicted_output": "([0, 1, 4, 9], [])"}}
{"submissionId": "cmssl291o0151jmp2bmqd4r4v", "title": "Submission QD4R4V", "payload": {"code": "def bucketize(nums):\n return {n: 'even' if n % 2 == 0 else 'odd' for n in nums}\n", "input": "bucketize([5, 2, 8, 1])", "language": "Python", "predicted_output": "{5: 'odd', 2: 'even', 8: 'even', 1: 'odd'}"}}
{"submissionId": "cmssl291o0152jmp2907d53rx", "title": "Submission 7D53RX", "payload": {"code": "def risky(x):\n try:\n return 10 / x\n except ZeroDivisionError:\n return -1\n finally:\n pass\n", "input": "(risky(2), risky(0))", "language": "Python", "predicted_output": "(5.0, -1)"}}
{"submissionId": "cmsslaz2g015fjmp2owavw52v", "title": "Submission AVW52V", "payload": {"code": "from collections import Counter\n\ndef rank_tags(tags, limit):\n counts = Counter(tags)\n top = counts.most_common(limit)\n return [name for name, _ in top], counts.total()", "input": "rank_tags(['api', 'db', 'api', 'ui', 'db', 'api', 'ui'], 2)", "language": "Python", "predicted_output": "(['api', 'db'], 7)"}}
{"submissionId": "cmsslaz2g015gjmp24avbq5cn", "title": "Submission VBQ5CN", "payload": {"code": "def collect(entry, seen=[]):\n seen.append(entry)\n return list(seen)\n\ndef audit():\n first = collect('alpha')\n second = collect('beta')\n return first, second", "input": "audit()", "language": "Python", "predicted_output": "(['alpha'], ['alpha', 'beta'])"}}
{"submissionId": "cmsslaz2g015hjmp2jqth2rgv", "title": "Submission TH2RGV", "payload": {"code": "from itertools import groupby\n\ndef summarize(records):\n out = {}\n for key, group in groupby(records, key=lambda r: r[0]):\n out.setdefault(key, []).extend(r[1] for r in group)\n return out", "input": "summarize([('a', 1), ('b', 2), ('a', 3), ('a', 4)])", "language": "Python", "predicted_output": "{'a': [1, 3, 4], 'b': [2]}"}}
{"submissionId": "cmsslaz2g015ijmp2cb4ih9wd", "title": "Submission 4IH9WD", "payload": {"code": "def parse_port(raw):\n try:\n value = int(raw)\n if not 0 < value < 65536:\n raise ValueError('out of range')\n return value\n except ValueError:\n return -1\n finally:\n if raw == '':\n return 0", "input": "(parse_port('8080'), parse_port('70000'), parse_port('abc'), parse_port(''))", "language": "Python", "predicted_output": "(8080, -1, -1, 0)"}}
{"submissionId": "cmsslaz2g015jjmp2cake44iy", "title": "Submission KE44IY", "payload": {"code": "def normalize(readings):\n buckets = {}\n for name, value in readings:\n buckets[name] = round(value, 1)\n ordered = sorted(buckets.items(), key=lambda kv: (-kv[1], kv[0]))\n return ordered", "input": "normalize([('east', 2.25), ('west', 2.35), ('north', 0.15), ('east', 1.05)])", "language": "Python", "predicted_output": "[('west', 2.4), ('east', 1.1), ('north', 0.1)]"}}
{"submissionId": "cmsslub3l0172jmp2x9fqet0l", "title": "Submission FQET0L", "payload": {"code": "def add_numbers(a, b):\n return a + b", "input": "add_numbers(2, 3)", "language": "Python", "predicted_output": "5"}}
{"submissionId": "cmsslujti0173jmp28ssil2wj", "title": "Submission SIL2WJ", "payload": {"code": "from functools import lru_cache\n\n@lru_cache(maxsize=None)\ndef fib(n):\n if n < 2:\n return n\n return fib(n-1) + fib(n-2)", "input": "fib(9)", "language": "Python", "predicted_output": "34"}}
{"submissionId": "cmsslv0760174jmp2qe91eag7", "title": "Submission 91EAG7", "payload": {"code": "def make_accumulator():\n total = 0\n history = []\n\n def add(x):\n nonlocal total\n total += x\n history.append(total)\n return total\n\n return add, history\n\ndef run_accumulator(values):\n add, history = make_accumulator()\n results = [add(v) for v in values]\n return results, history", "input": "run_accumulator([5, -2, 10])", "language": "Python", "predicted_output": "([5, 3, 13], [5, 3, 13])"}}
{"submissionId": "cmsslvr6m017pjmp24bulv49c", "title": "Submission ULV49C", "payload": {"code": "class InsufficientFundsError(Exception):\n pass\n\ndef withdraw(balance, amount):\n log = []\n try:\n if amount > balance:\n raise InsufficientFundsError(f\"cannot withdraw {amount} from {balance}\")\n balance -= amount\n return balance, log\n except InsufficientFundsError as e:\n return str(e), log\n finally:\n log.append(\"attempt complete\")", "input": "(withdraw(100, 30), withdraw(50, 80))", "language": "Python", "predicted_output": "((70, ['attempt complete']), ('cannot withdraw 80 from 50', ['attempt complete']))"}}
{"submissionId": "cmsslvr6m017qjmp28sk341tn", "title": "Submission K341TN", "payload": {"code": "def flatten_evens(matrix):\n return [value for row in matrix for value in row if value % 2 == 0]", "input": "flatten_evens([[1,2,3],[4,5,6],[7,8,9]])", "language": "Python", "predicted_output": "[2, 4, 6, 8]"}}
{"submissionId": "cmsslvr6m017rjmp2y9bv2uqf", "title": "Submission BV2UQF", "payload": {"code": "from collections import Counter\n\ndef top_letters(text, n):\n counts = Counter(c for c in text.lower() if c.isalpha())\n return counts.most_common(n)", "input": "top_letters('Mississippi River', 3)", "language": "Python", "predicted_output": "[('i', 5), ('s', 4), ('p', 2)]"}}
{"submissionId": "cmsslvr6m017sjmp2pcib3nwm", "title": "Submission IB3NWM", "payload": {"code": "from collections import defaultdict\n\ndef group_by_mod(numbers, mod):\n groups = defaultdict(list)\n for num in numbers:\n groups[num % mod].append(num)\n return dict(groups)", "input": "group_by_mod([10, 21, 32, 43, 54, 65], 3)", "language": "Python", "predicted_output": "{1: [10, 43], 0: [21, 54], 2: [32, 65]}"}}
{"submissionId": "cmsslvr6m017tjmp2oem0wof7", "title": "Submission M0WOF7", "payload": {"code": "def rank_students(students):\n return sorted(students, key=lambda s: (-s[1], s[0]))", "input": "rank_students([('Ann', 88), ('Bo', 92), ('Cid', 88), ('Dee', 92)])", "language": "Python", "predicted_output": "[('Bo', 92), ('Dee', 92), ('Ann', 88), ('Cid', 88)]"}}
{"submissionId": "cmsslvr6m017vjmp2feh2nqb1", "title": "Submission H2NQB1", "payload": {"code": "def factorial(n, _cache={0: 1, 1: 1}):\n if n in _cache:\n return _cache[n]\n result = n * factorial(n - 1, _cache)\n _cache[n] = result\n return result", "input": "(factorial(5), factorial(6), sorted(factorial.__defaults__[0].items()))", "language": "Python", "predicted_output": "(120, 720, [(0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120), (6, 720)])"}}
{"submissionId": "cmsslvr6m017wjmp22uvvet3w", "title": "Submission VVET3W", "payload": {"code": "def analyze_sets(a, b):\n return {\n 'union': sorted(a | b),\n 'intersection': sorted(a & b),\n 'difference': sorted(a - b),\n 'symmetric_difference': sorted(a ^ b),\n }", "input": "analyze_sets({1,2,3,4}, {3,4,5,6})", "language": "Python", "predicted_output": "{'union': [1, 2, 3, 4, 5, 6], 'intersection': [3, 4], 'difference': [1, 2], 'symmetric_difference': [1, 2, 5, 6]}"}}
{"submissionId": "cmsslvr6m017xjmp2o7n96ms7", "title": "Submission N96MS7", "payload": {"code": "from collections import namedtuple\n\nPoint = namedtuple('Point', ['x', 'y'])\n\ndef reflect(points):\n return [Point(p.y, p.x) for p in points]", "input": "reflect([Point(1, 2), Point(3, 4)])", "language": "Python", "predicted_output": "[Point(x=2, y=1), Point(x=4, y=3)]"}}
{"submissionId": "cmsslvr6m017yjmp2iscxwa6x", "title": "Submission CXWA6X", "payload": {"code": "from dataclasses import dataclass, field\nfrom typing import List\n\n@dataclass\nclass Cart:\n items: List[str] = field(default_factory=list)\n total: float = 0.0\n\n def add(self, name, price):\n self.items.append(name)\n self.total += price\n return self", "input": "(Cart().add('apple', 1.5).add('bread', 2.25), Cart())", "language": "Python", "predicted_output": "(Cart(items=['apple', 'bread'], total=3.75), Cart(items=[], total=0.0))"}}
{"submissionId": "cmsslvr6m017zjmp27pg49bbz", "title": "Submission G49BBZ", "payload": {"code": "import itertools\n\ndef group_lengths(words):\n data = sorted(words, key=len)\n return {length: list(group) for length, group in itertools.groupby(data, key=len)}", "input": "group_lengths(['fig', 'kiwi', 'pear', 'plum', 'date', 'apple'])", "language": "Python", "predicted_output": "{3: ['fig'], 4: ['kiwi', 'pear', 'plum', 'date'], 5: ['apple']}"}}
{"submissionId": "cmsslvr6m0180jmp2r9tab0yo", "title": "Submission TAB0YO", "payload": {"code": "def round_all(values, ndigits):\n return [round(v, ndigits) for v in values]", "input": "round_all([2.675, 0.125, 1.005, 2.5, 3.5], 2)", "language": "Python", "predicted_output": "[2.67, 0.12, 1.0, 2.5, 3.5]"}}
{"submissionId": "cmsslvr6m0181jmp2t69rj7nv", "title": "Submission 9RJ7NV", "payload": {"code": "def slice_variants(s):\n return (s[::-1], s[2:-2], s[-1:-6:-2], s[::3])", "input": "slice_variants('abcdefghij')", "language": "Python", "predicted_output": "('jihgfedcba', 'cdefgh', 'jhf', 'adgj')"}}
{"submissionId": "cmsslvr6m0182jmp2j8g4h86a", "title": "Submission G4H86A", "payload": {"code": "def process_lists(original):\n alias = original\n snapshot = original[:]\n alias.append(99)\n original.sort()\n return original, alias, snapshot", "input": "process_lists([5, 3, 8, 1])", "language": "Python", "predicted_output": "([1, 3, 5, 8, 99], [1, 3, 5, 8, 99], [5, 3, 8, 1])"}}
{"submissionId": "cmsslvr6m0183jmp28s3jafwu", "title": "Submission 3JAFWU", "payload": {"code": "class ParseError(Exception):\n pass\n\ndef parse_number(text):\n trace = []\n try:\n value = int(text)\n except ValueError as e:\n trace.append('conversion failed')\n raise ParseError(f\"bad input: {text}\") from e\n else:\n trace.append('conversion ok')\n return value, trace\n finally:\n trace.append('done')", "input": "parse_number('42')", "language": "Python", "predicted_output": "(42, ['conversion ok', 'done'])"}}
{"submissionId": "cmsslvr6m0184jmp2y4xnd359", "title": "Submission XND359", "payload": {"code": "def pair_data(names, scores):\n return [f\"{i}:{name}={score}\" for i, (name, score) in enumerate(zip(names, scores), start=1)]", "input": "pair_data(['Al', 'Bo', 'Cy', 'Do'], [10, 20, 30])", "language": "Python", "predicted_output": "['1:Al=10', '2:Bo=20', '3:Cy=30']"}}
{"submissionId": "cmsslvr6m0185jmp2kedryiyl", "title": "Submission DRYIYL", "payload": {"code": "def bit_report(a, b):\n return {\n 'and': a & b,\n 'or': a | b,\n 'xor': a ^ b,\n 'left_shift': a << 2,\n 'right_shift': b >> 1,\n 'invert_a': ~a,\n }", "input": "bit_report(12, 10)", "language": "Python", "predicted_output": "{'and': 8, 'or': 14, 'xor': 6, 'left_shift': 48, 'right_shift': 5, 'invert_a': -13}"}}
{"submissionId": "cmssm488101bnjmp2lprsk0vh", "title": "Submission RSK0VH", "payload": {"code": "def add_item(item, bucket=[]):\n bucket.append(item)\n return bucket\n", "input": "(add_item(1), add_item(2))", "language": "Python", "predicted_output": "([1, 2], [1, 2])"}}
{"submissionId": "cmssm488101bojmp2cy5eyvma", "title": "Submission 5EYVMA", "payload": {"code": "def describe(person):\n return f\"{person['name']} is {person['age']} years old\"\n", "input": "describe({'name': 'Ada', 'age': 30})", "language": "Python", "predicted_output": "Ada is 30 years old"}}
{"submissionId": "cmssm488101bpjmp2ie1h3tnq", "title": "Submission 1H3TNQ", "payload": {"code": "def gen():\n yield 1\n yield 2\n yield 3\n", "input": "(lambda g: (list(g), list(g)))(gen())", "language": "Python", "predicted_output": "([1, 2, 3], [])"}}
{"submissionId": "cmssm488101bqjmp2f9om7tir", "title": "Submission OM7TIR", "payload": {"code": "def sort_by_abs(nums):\n return sorted(nums, key=abs)\n", "input": "sort_by_abs([3, -1, -2, 0, -3])", "language": "Python", "predicted_output": "[0, -1, -2, 3, -3]"}}
{"submissionId": "cmssm488101brjmp27ic6hdkn", "title": "Submission C6HDKN", "payload": {"code": "def divmod_info(a, b):\n return divmod(a, b)\n", "input": "divmod_info(-7, 3)", "language": "Python", "predicted_output": "(-3, 2)"}}
{"submissionId": "cmssng1ei0000g4p249od4kif", "title": "Submission OD4KIF", "payload": {"code": "def run_counter_trace(start, step, calls):\n count = [start]\n def counter():\n count[0] += step\n return count[0]\n def reset():\n count[0] = start\n return count[0]\n results = []\n for c in calls:\n if c == 'reset':\n results.append(reset())\n else:\n results.append(counter())\n return results", "input": "run_counter_trace(10, 5, ['call','call','reset','call'])", "language": "Python", "predicted_output": "[15, 20, 10, 15]"}}
{"submissionId": "cmssnh1280001g4p2y7tduvzj", "title": "Submission TDUVZJ", "payload": {"code": "def weird_sum(values):\n total = 0\n details = []\n for v in values:\n total += v\n details.append(type(v).__name__)\n return total, details", "input": "weird_sum([True, False, 3, 1.5, True])", "language": "Python", "predicted_output": "(6.5, ['bool', 'bool', 'int', 'float', 'bool'])"}}
{"submissionId": "cmssnh1280002g4p206qcw0hz", "title": "Submission QCW0HZ", "payload": {"code": "def slice_variants(seq):\n return [\n seq[::-1],\n seq[1:-1],\n seq[-100:100],\n seq[5:2],\n seq[::2],\n ]", "input": "slice_variants([0,1,2,3,4,5])", "language": "Python", "predicted_output": "[[5, 4, 3, 2, 1, 0], [1, 2, 3, 4], [0, 1, 2, 3, 4, 5], [], [0, 2, 4]]"}}
{"submissionId": "cmssnh1280003g4p2tt8t5cna", "title": "Submission 8T5CNA", "payload": {"code": "def tree_sum(node):\n if node is None:\n return 0\n left = tree_sum(node.get(\"left\"))\n right = tree_sum(node.get(\"right\"))\n return node.get(\"value\", 0) + left + right\n\ndef build_and_sum():\n tree = {\n \"value\": 5,\n \"left\": {\"value\": 3, \"left\": None, \"right\": {\"value\": 2}},\n \"right\": {\"value\": 8, \"left\": {\"value\": -1}, \"right\": None}\n }\n return tree_sum(tree)", "input": "build_and_sum()", "language": "Python", "predicted_output": "17"}}
{"submissionId": "cmssnh1280004g4p2vb8qdeh9", "title": "Submission 8QDEH9", "payload": {"code": "def build_lookup(pairs):\n return {k: v for k, v in pairs}\n\ndef merge_and_count(pairs):\n lookup = build_lookup(pairs)\n return lookup, len(pairs) - len(lookup)", "input": "merge_and_count([(\"a\",1),(\"b\",2),(\"a\",3),(\"c\",4),(\"b\",5)])", "language": "Python", "predicted_output": "({'a': 3, 'b': 5, 'c': 4}, 2)"}}
{"submissionId": "cmssnh1280005g4p2fgx3y9cq", "title": "Submission X3Y9CQ", "payload": {"code": "def chunk(iterable, size):\n it = iter(iterable)\n while True:\n batch = []\n for _ in range(size):\n try:\n batch.append(next(it))\n except StopIteration:\n if batch:\n yield batch\n return\n yield batch\n\ndef chunk_list(lst, size):\n return list(chunk(lst, size))", "input": "chunk_list([1,2,3,4,5,6,7], 3)", "language": "Python", "predicted_output": "[[1, 2, 3], [4, 5, 6], [7]]"}}
{"submissionId": "cmssnh1280006g4p2xqi6dcdm", "title": "Submission I6DCDM", "payload": {"code": "class Shape:\n def __init__(self, name):\n self.name = name\n def describe(self):\n return f\"{self.name}: area={self.area()}\"\n def area(self):\n return 0\n\nclass Rectangle(Shape):\n def __init__(self, w, h):\n super().__init__(\"Rectangle\")\n self.w = w\n self.h = h\n def area(self):\n return self.w * self.h\n\nclass Square(Rectangle):\n def __init__(self, s):\n super().__init__(s, s)\n self.name = \"Square\"\n\ndef describe_shapes():\n shapes = [Rectangle(3,4), Square(5), Shape(\"Blob\")]\n return [s.describe() for s in shapes]", "input": "describe_shapes()", "language": "Python", "predicted_output": "['Rectangle: area=12', 'Square: area=25', 'Blob: area=0']"}}
{"submissionId": "cmssnh1280007g4p2eu6gbi9h", "title": "Submission 6GBI9H", "payload": {"code": "def safe_divide_all(pairs):\n results = []\n for a, b in pairs:\n try:\n results.append(a / b)\n except ZeroDivisionError:\n results.append(float('inf') if a > 0 else float('-inf') if a < 0 else float('nan'))\n return results", "input": "safe_divide_all([(10,2),(5,0),(-5,0),(0,0),(9,3)])", "language": "Python", "predicted_output": "[5.0, inf, -inf, nan, 3.0]"}}
{"submissionId": "cmssnh1280008g4p2bxam0f4q", "title": "Submission AM0F4Q", "payload": {"code": "def analyze_sets(a, b):\n sa, sb = set(a), set(b)\n return {\n \"union\": sorted(sa | sb),\n \"intersection\": sorted(sa & sb),\n \"sym_diff\": sorted(sa ^ sb),\n \"only_a\": sorted(sa - sb),\n }", "input": "analyze_sets([1,2,3,2,4], [3,4,5,5,6])", "language": "Python", "predicted_output": "{'union': [1, 2, 3, 4, 5, 6], 'intersection': [3, 4], 'sym_diff': [1, 2, 5, 6], 'only_a': [1, 2]}"}}
{"submissionId": "cmssnh1280009g4p2jqpxhw06", "title": "Submission PXHW06", "payload": {"code": "def format_report(values):\n lines = []\n for label, val in values:\n if isinstance(val, float):\n lines.append(f\"{label:>10}: {val:8.2f}\")\n else:\n lines.append(f\"{label:>10}: {val:>8,}\")\n return lines", "input": "format_report([(\"total\", 1234567), (\"avg\", 42.5), (\"neg\", -3)])", "language": "Python", "predicted_output": "[' total: 1,234,567', ' avg: 42.50', ' neg: -3']"}}
{"submissionId": "cmssnh128000ag4p2cy6e8t6q", "title": "Submission 6E8T6Q", "payload": {"code": "def make_transaction_processor(initial_balance):\n balance = initial_balance\n history = []\n def process(amount):\n nonlocal balance\n if balance + amount < 0:\n history.append((\"rejected\", amount))\n return False\n balance += amount\n history.append((\"applied\", amount))\n return True\n def summary():\n return balance, history[:]\n process.summary = summary\n return process\n\ndef run_transactions(initial, amounts):\n proc = make_transaction_processor(initial)\n for amt in amounts:\n proc(amt)\n return proc.summary()", "input": "run_transactions(100, [-50, 30, -200, -80, 25])", "language": "Python", "predicted_output": "(25, [('applied', -50), ('applied', 30), ('rejected', -200), ('applied', -80), ('applied', 25)])"}}
{"submissionId": "cmssnhet2000bg4p2tkmsogh1", "title": "Submission MSOGH1", "payload": {"code": "class ValidationError(Exception):\n pass\n\ndef parse_age(s):\n try:\n age = int(s)\n except ValueError as e:\n raise ValidationError(f\"invalid age: {s!r}\") from e\n if age < 0 or age > 150:\n raise ValidationError(f\"age out of range: {age}\")\n return age\n\ndef safe_parse_ages(values):\n results = []\n for v in values:\n try:\n results.append(parse_age(v))\n except ValidationError as e:\n results.append(str(e))\n return results", "input": "safe_parse_ages([\"30\", \"abc\", \"-5\", \"200\", \"45\"])", "language": "Python", "predicted_output": "[30, \"invalid age: 'abc'\", 'age out of range: -5', 'age out of range: 200', 45]"}}
{"submissionId": "cmssnhet2000cg4p26mwu9z6f", "title": "Submission WU9Z6F", "payload": {"code": "def tokenize(expr):\n tokens = []\n current = \"\"\n for ch in expr:\n if ch in \"+-*/()\":\n if current:\n tokens.append(current)\n current = \"\"\n tokens.append(ch)\n elif ch == \" \":\n if current:\n tokens.append(current)\n current = \"\"\n else:\n current += ch\n if current:\n tokens.append(current)\n return tokens", "input": "tokenize(\"12 + (3*4)- 5\")", "language": "Python", "predicted_output": "['12', '+', '(', '3', '*', '4', ')', '-', '5']"}}
{"submissionId": "cmssnhet2000dg4p24zliqztm", "title": "Submission LIQZTM", "payload": {"code": "def rank_students(records):\n return sorted(records, key=lambda r: (-r[1], r[2], r[0]))", "input": "rank_students([(\"Amy\",90,20),(\"Bob\",85,22),(\"Cid\",90,19),(\"Dan\",85,21)])", "language": "Python", "predicted_output": "[('Cid', 90, 19), ('Amy', 90, 20), ('Dan', 85, 21), ('Bob', 85, 22)]"}}
{"submissionId": "cmssnhet2000eg4p2y578elhy", "title": "Submission 78ELHY", "payload": {"code": "def append_item(item, bucket=[]):\n bucket.append(item)\n return bucket\n\ndef run_mutation_demo():\n a = append_item(1)\n b = append_item(2)\n c = append_item(3, [])\n return a, b, c, a is b", "input": "run_mutation_demo()", "language": "Python", "predicted_output": "([1, 2], [1, 2], [3], True)"}}
{"submissionId": "cmssnhet2000fg4p2k80xmero", "title": "Submission 0XMERO", "payload": {"code": "def memoize(fn):\n cache = {}\n calls = {\"count\": 0}\n def wrapper(*args):\n calls[\"count\"] += 1\n if args in cache:\n return cache[args]\n result = fn(*args)\n cache[args] = result\n return result\n wrapper.calls = calls\n return wrapper\n\n@memoize\ndef slow_square(x):\n return x * x\n\ndef memo_trace(xs):\n results = [slow_square(x) for x in xs]\n return results, slow_square.calls[\"count\"]", "input": "memo_trace([2,3,2,4,3,2])", "language": "Python", "predicted_output": "([4, 9, 4, 16, 9, 4], 6)"}}
{"submissionId": "cmssni7gx000gg4p2xmdg8ovu", "title": "Submission DG8OVU", "payload": {"code": "def group_by_length(words):\n groups = {}\n for w in words:\n groups.setdefault(len(w), []).append(w)\n return {k: groups[k] for k in sorted(groups)}", "input": "group_by_length([\"a\",\"bb\",\"cc\",\"ddd\",\"e\",\"ffff\"])", "language": "Python", "predicted_output": "{1: ['a', 'e'], 2: ['bb', 'cc'], 3: ['ddd'], 4: ['ffff']}"}}
{"submissionId": "cmssni7gx000hg4p2rbzm7d6p", "title": "Submission ZM7D6P", "payload": {"code": "class Point:\n __slots__ = ('x','y')\n def __init__(self,x,y):\n self.x=x; self.y=y\n def __eq__(self,other):\n return isinstance(other,Point) and self.x==other.x and self.y==other.y\n def __hash__(self):\n return hash((self.x,self.y))\n def __repr__(self):\n return f\"Point({self.x},{self.y})\"\n\ndef dedup_points(pairs):\n pts = [Point(x,y) for x,y in pairs]\n unique = set(pts)\n return sorted(unique, key=lambda p:(p.x,p.y))", "input": "dedup_points([(1,2),(3,4),(1,2),(0,0),(3,4)])", "language": "Python", "predicted_output": "[Point(0,0), Point(1,2), Point(3,4)]"}}
{"submissionId": "cmssniip4000ig4p29uf6axbk", "title": "Submission F6AXBK", "payload": {"code": "def running_average():\n total = 0\n count = 0\n avg = None\n while True:\n value = yield avg\n total += value\n count += 1\n avg = total / count\n\ndef average_trace(values):\n gen = running_average()\n next(gen)\n return [gen.send(v) for v in values]", "input": "average_trace([10, 20, 30, 40])", "language": "Python", "predicted_output": "[10.0, 15.0, 20.0, 25.0]"}}
{"submissionId": "cmssnktje000jg4p279v0c36l", "title": "Submission V0C36L", "payload": {"code": "def fib_with_cache(n, cache={}):\n if n in cache:\n return cache[n]\n if n <= 1:\n result = n\n else:\n result = fib_with_cache(n-1, cache) + fib_with_cache(n-2, cache)\n cache[n] = result\n return result", "input": "(fib_with_cache(10), fib_with_cache(6), fib_with_cache(10))", "language": "Python", "predicted_output": "(55, 8, 55)"}}
{"submissionId": "cmsspw5i9002sg4p2whb4qvou", "title": "Submission B4QVOU", "payload": {"code": "def merge_windows(windows):\n ordered = sorted(windows)\n merged = []\n for start, end in ordered:\n if merged and start <= merged[-1][1]:\n merged[-1] = (merged[-1][0], max(merged[-1][1], end))\n else:\n merged.append((start, end))\n return merged", "input": "merge_windows([(5, 7), (1, 3), (2, 6), (9, 9)])", "language": "Python", "predicted_output": "[(1, 7), (9, 9)]"}}
{"submissionId": "cmsspw5ia002tg4p25wo72nzt", "title": "Submission O72NZT", "payload": {"code": "def tally_votes(ballots):\n counts = {}\n for ballot in ballots:\n for rank, name in enumerate(ballot):\n counts[name] = counts.get(name, 0) + (len(ballot) - rank)\n return sorted(counts.items(), key=lambda kv: (-kv[1], kv[0]))", "input": "tally_votes([['ana', 'bo'], ['bo', 'cy', 'ana'], ['cy']])", "language": "Python", "predicted_output": "[('bo', 4), ('ana', 3), ('cy', 3)]"}}
{"submissionId": "cmsspw5ia002ug4p2fdrhzyju", "title": "Submission RHZYJU", "payload": {"code": "class Ledger:\n def __init__(self):\n self.entries = []\n def post(self, amount):\n if amount == 0:\n raise ValueError('zero entry')\n self.entries.append(amount)\n return len(self.entries)\n\ndef run(amounts):\n ledger = Ledger()\n errors = 0\n for amount in amounts:\n try:\n ledger.post(amount)\n except ValueError:\n errors += 1\n return sum(ledger.entries), errors, len(ledger.entries)", "input": "run([10, 0, -4, 0, 7])", "language": "Python", "predicted_output": "(13, 2, 3)"}}
{"submissionId": "cmsspyuqf002vg4p2hpfmctli", "title": "Submission FMCTLI", "payload": {"code": "def first_overdraft(transactions, limit):\n balance = 0\n for index, amount in enumerate(transactions):\n balance += amount\n if balance < limit:\n return index, balance\n return None, balance", "input": "first_overdraft([100, -60, -30, -50, 200], -20)", "language": "Python", "predicted_output": "(3, -40)"}}
{"submissionId": "cmsspyuqf002wg4p208xr961i", "title": "Submission XR961I", "payload": {"code": "def prune_stale(inventory, threshold):\n removed = []\n for sku in list(inventory):\n if inventory[sku] < threshold:\n removed.append(sku)\n del inventory[sku]\n return inventory, removed", "input": "prune_stale({'ab': 5, 'cd': 0, 'ef': 12, 'gh': 2}, 3)", "language": "Python", "predicted_output": "({'ab': 5, 'ef': 12}, ['cd', 'gh'])"}}
{"submissionId": "cmsspyuqf002xg4p2g7k2hibx", "title": "Submission K2HIBX", "payload": {"code": "def normalize_code(raw, width=4):\n cleaned = ''.join(ch for ch in raw if ch.isalnum()).upper()\n chunks = [cleaned[i:i + width] for i in range(0, len(cleaned), width)]\n return '-'.join(chunks), cleaned[::-1][:width]", "input": "normalize_code('ab-12 cd/3e', 3)", "language": "Python", "predicted_output": "('AB1-2CD-3E', 'E3D')"}}
{"submissionId": "cmsspyuqf002yg4p2b6qc2t7c", "title": "Submission QC2T7C", "payload": {"code": "def collect(value, bucket=[]):\n bucket.append(value)\n return list(bucket)\n\ndef demo():\n return collect(1), collect(2), collect(3)", "input": "demo()", "language": "Python", "predicted_output": "([1], [1, 2], [1, 2, 3])"}}
{"submissionId": "cmsspyuqf002zg4p2furpyfd8", "title": "Submission RPYFD8", "payload": {"code": "def split_shifts(total_minutes, per_shift):\n full = total_minutes // per_shift\n remainder = total_minutes % per_shift\n ratio = total_minutes / per_shift\n return full, remainder, round(ratio, 2)", "input": "split_shifts(-95, 30)", "language": "Python", "predicted_output": "(-4, 25, -3.17)"}}
{"submissionId": "cmsspyuqf0030g4p2nw3dbklz", "title": "Submission 3DBKLZ", "payload": {"code": "def rank_entries(entries):\n by_score = sorted(entries, key=lambda e: e[1], reverse=True)\n return [name for name, _ in by_score]", "input": "rank_entries([('ivy', 7), ('jon', 9), ('kai', 7), ('lee', 9), ('moe', 3)])", "language": "Python", "predicted_output": "['jon', 'lee', 'ivy', 'kai', 'moe']"}}
{"submissionId": "cmsspyuqf0031g4p2djp90mjw", "title": "Submission P90MJW", "payload": {"code": "def guarded(steps):\n log = []\n for step in steps:\n try:\n if step == 'boom':\n raise RuntimeError(step)\n log.append('ok:' + step)\n except RuntimeError as exc:\n log.append('err:' + str(exc))\n continue\n finally:\n log.append('fin')\n return log", "input": "guarded(['a', 'boom', 'b'])", "language": "Python", "predicted_output": "['ok:a', 'fin', 'err:boom', 'fin', 'ok:b', 'fin']"}}
{"submissionId": "cmsspyuqf0032g4p23huiam7j", "title": "Submission UIAM7J", "payload": {"code": "def make_adders(offsets):\n funcs = []\n for off in offsets:\n funcs.append(lambda x, off=off: x + off)\n late = []\n for off in offsets:\n late.append(lambda x: x + off)\n return [f(10) for f in funcs], [f(10) for f in late]", "input": "make_adders([1, 2, 3])", "language": "Python", "predicted_output": "([11, 12, 13], [13, 13, 13])"}}
{"submissionId": "cmsspyuqf0033g4p2ou02yufi", "title": "Submission 02YUFI", "payload": {"code": "def parse_record(line):\n key, _, rest = line.partition('=')\n parts = rest.split(',', 2)\n return key.strip(), len(parts), parts", "input": "parse_record(' mode = fast,,deep,extra ')", "language": "Python", "predicted_output": "('mode', 3, [' fast', '', 'deep,extra '])"}}
{"submissionId": "cmsspyuqf0034g4p2pqmcqbfs", "title": "Submission MCQBFS", "payload": {"code": "def pair_up(names, scores):\n paired = [(n, s) for n, s in zip(names, scores) if s >= 50]\n total = sum(s for _, s in paired)\n return paired, total, len(names) - len(scores)", "input": "pair_up(['p', 'q', 'r', 's'], [80, 20, 55])", "language": "Python", "predicted_output": "([('p', 80), ('r', 55)], 135, 1)"}}
{"submissionId": "cmsspyuqf0035g4p2gd97u6zt", "title": "Submission 97U6ZT", "payload": {"code": "def paths(rows, cols, memo=None):\n if memo is None:\n memo = {}\n if rows == 1 or cols == 1:\n return 1\n key = (rows, cols)\n if key not in memo:\n memo[key] = paths(rows - 1, cols, memo) + paths(rows, cols - 1, memo)\n return memo[key]", "input": "(paths(3, 3), paths(4, 2), paths(1, 9))", "language": "Python", "predicted_output": "(6, 4, 1)"}}
{"submissionId": "cmsspyuqf0036g4p2w5nrawi0", "title": "Submission NRAWI0", "payload": {"code": "def audit_flags(readings, ceiling):\n breaches = [r > ceiling for r in readings]\n return sum(breaches), breaches.count(True), all(breaches), any(breaches)", "input": "audit_flags([3, 11, 7, 20], 10)", "language": "Python", "predicted_output": "(2, 2, False, True)"}}
{"submissionId": "cmssudjwf007dg4p26ho7spcu", "title": "Submission O7SPCU", "payload": {"code": "def alternating_totals(values):\n total=0\n out=[]\n for i,v in enumerate(values):\n total += v if i%2==0 else -v\n out.append(total)\n return out", "input": "alternating_totals([5,2,4,1])", "language": "Python", "predicted_output": "[5, 3, 7, 6]"}}
{"submissionId": "cmssudjwf007eg4p2d6z2tpao", "title": "Submission Z2TPAO", "payload": {"code": "def chunk_sums(values,size):\n return [sum(values[i:i+size]) for i in range(0,len(values),size)]", "input": "chunk_sums([1,2,3,4,5],2)", "language": "Python", "predicted_output": "[3, 7, 5]"}}
{"submissionId": "cmssudjwf007fg4p2oxtjjlpv", "title": "Submission TJJLPV", "payload": {"code": "def normalize_counts(words):\n from collections import Counter\n c=Counter(w.lower() for w in words)\n return sorted(c.items())", "input": "normalize_counts(['A','b','a','B','c'])", "language": "Python", "predicted_output": "[('a', 2), ('b', 2), ('c', 1)]"}}
{"submissionId": "cmssudjwg007hg4p2ob3lwuy6", "title": "Submission 3LWUY6", "payload": {"code": "def rotate_pairs(items):\n return [(b,a) for a,b in items[::-1]]", "input": "rotate_pairs([(1,'a'),(2,'b'),(3,'c')])", "language": "Python", "predicted_output": "[('c', 3), ('b', 2), ('a', 1)]"}}
{"submissionId": "cmssudjwg007ig4p2ly0j2u56", "title": "Submission 0J2U56", "payload": {"code": "def safe_get(mapping,path,default=None):\n cur=mapping\n for key in path:\n if not isinstance(cur,dict) or key not in cur:\n return default\n cur=cur[key]\n return cur", "input": "safe_get({'a':{'b':{'c':7}}},['a','b','c'],'x')", "language": "Python", "predicted_output": "7"}}
{"submissionId": "cmssudjwg007jg4p2re87nx4e", "title": "Submission 87NX4E", "payload": {"code": "def window_diffs(values):\n return [values[i+1]-values[i] for i in range(len(values)-1)]", "input": "window_diffs([10,7,9,3])", "language": "Python", "predicted_output": "[-3, 2, -6]"}}
{"submissionId": "cmssudjwg007kg4p2yxejllg5", "title": "Submission EJLLG5", "payload": {"code": "def classify(nums):\n return {'neg':sum(x<0 for x in nums),'zero':sum(x==0 for x in nums),'pos':sum(x>0 for x in nums)}", "input": "classify([-2,0,4,5,-1,0])", "language": "Python", "predicted_output": "{'neg': 2, 'zero': 2, 'pos': 2}"}}
{"submissionId": "cmssudjwg007lg4p2vxs4age0", "title": "Submission S4AGE0", "payload": {"code": "def unique_preserve(seq):\n seen=set(); out=[]\n for x in seq:\n if x not in seen:\n seen.add(x); out.append(x)\n return out", "input": "unique_preserve([3,1,3,2,1,4])", "language": "Python", "predicted_output": "[3, 1, 2, 4]"}}
{"submissionId": "cmssudjwg007mg4p2g9rvuyur", "title": "Submission RVUYUR", "payload": {"code": "def score_rows(rows):\n return [name+':' + str(sum(vals)) for name,*vals in rows]", "input": "score_rows([('a',2,3),('b',5,-1,2)])", "language": "Python", "predicted_output": "['a:5', 'b:6']"}}
{"submissionId": "cmssudjwg007ng4p2mn7khp0w", "title": "Submission 7KHP0W", "payload": {"code": "def invert_groups(groups):\n out={}\n for k,vals in groups.items():\n for v in vals:\n out.setdefault(v,[]).append(k)\n return out", "input": "invert_groups({'x':[1,2],'y':[2,3]})", "language": "Python", "predicted_output": "{1: ['x'], 2: ['x', 'y'], 3: ['y']}"}}
{"submissionId": "cmssudjwg007og4p2b0i89ep1", "title": "Submission I89EP1", "payload": {"code": "def clamp_and_sum(values,lo,hi):\n return sum(min(hi,max(lo,v)) for v in values)", "input": "clamp_and_sum([-5,3,20,7],0,10)", "language": "Python", "predicted_output": "20"}}
{"submissionId": "cmssudjwg007pg4p2p8n6weih", "title": "Submission N6WEIH", "payload": {"code": "def parse_flags(tokens):\n result={}\n for token in tokens:\n if token.startswith('--') and '=' in token:\n k,v=token[2:].split('=',1); result[k]=v\n return result", "input": "parse_flags(['--mode=fast','x','--retry=3','--mode=safe'])", "language": "Python", "predicted_output": "{'mode': 'safe', 'retry': '3'}"}}
{"submissionId": "cmssudjwg007qg4p22ei52l12", "title": "Submission I52L12", "payload": {"code": "def cumulative_lengths(words):\n total=0; out=[]\n for w in words:\n total+=len(w); out.append(total)\n return out", "input": "cumulative_lengths(['ab','cde','','x'])", "language": "Python", "predicted_output": "[2, 5, 5, 6]"}}
{"submissionId": "cmssudjwg007rg4p2j2aruwnn", "title": "Submission ARUWNN", "payload": {"code": "def split_even_odd(nums):\n return ([x for x in nums if x%2==0],[x for x in nums if x%2])", "input": "split_even_odd([5,2,8,3,0,-1])", "language": "Python", "predicted_output": "([2, 8, 0], [5, 3, -1])"}}
{"submissionId": "cmssudjwg007sg4p2jk4a922h", "title": "Submission 4A922H", "payload": {"code": "def summarize_matrix(m):\n return [sum(row) for row in m], [sum(col) for col in zip(*m)]", "input": "summarize_matrix([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "([6, 15], [5, 7, 9])"}}
{"submissionId": "cmssudjwg007tg4p2odxhirea", "title": "Submission XHIREA", "payload": {"code": "def take_until(values,predicate):\n out=[]\n for x in values:\n if predicate(x): break\n out.append(x)\n return out", "input": "take_until([2,4,7,8], lambda x:x%2==1)", "language": "Python", "predicted_output": "[2, 4]"}}
{"submissionId": "cmssudjwg007vg4p2obmkwd8s", "title": "Submission MKWD8S", "payload": {"code": "def index_by_initial(words):\n out={}\n for w in words:\n out.setdefault(w[0].lower(),[]).append(w)\n return out", "input": "index_by_initial(['Apple','ant','Boat','berry'])", "language": "Python", "predicted_output": "{'a': ['Apple', 'ant'], 'b': ['Boat', 'berry']}"}}
{"submissionId": "cmssudjwg007xg4p2qz8dtsc0", "title": "Submission 8DTSC0", "payload": {"code": "def pairwise_min(a,b):\n return [min(x,y) for x,y in zip(a,b)]", "input": "pairwise_min([3,8,-1,5],[4,2,-3,9])", "language": "Python", "predicted_output": "[3, 2, -3, 5]"}}
{"submissionId": "cmssudjwg007yg4p2dkwbv3p8", "title": "Submission WBV3P8", "payload": {"code": "def guarded_divisions(pairs):\n out=[]\n for a,b in pairs:\n try: out.append(round(a/b,2))\n except ZeroDivisionError: out.append(None)\n return out", "input": "guarded_divisions([(5,2),(7,0),(-3,2)])", "language": "Python", "predicted_output": "[2.5, None, -1.5]"}}
{"submissionId": "cmssudjwg0080g4p2wgpfwgfh", "title": "Submission PFWGFH", "payload": {"code": "def map_lengths(mapping):\n return {k:len(v) for k,v in sorted(mapping.items())}", "input": "map_lengths({'b':[1,2,3],'a':[],'c':[9]})", "language": "Python", "predicted_output": "{'a': 0, 'b': 3, 'c': 1}"}}
{"submissionId": "cmssudjwg0082g4p20gxcz7xf", "title": "Submission XCZ7XF", "payload": {"code": "def weighted_sum(values):\n return sum((i+1)*v for i,v in enumerate(values))", "input": "weighted_sum([4,-2,3])", "language": "Python", "predicted_output": "9"}}
{"submissionId": "cmssudjwg0083g4p2fenbb2a1", "title": "Submission NBB2A1", "payload": {"code": "def trim_empty(rows):\n return [[x for x in row if x is not None] for row in rows if any(x is not None for x in row)]", "input": "trim_empty([[1,None,2],[None,None],[3,4,None]])", "language": "Python", "predicted_output": "[[1, 2], [3, 4]]"}}
{"submissionId": "cmssudjwg0084g4p29zad55l5", "title": "Submission AD55L5", "payload": {"code": "def histogram_lengths(words):\n from collections import Counter\n return dict(sorted(Counter(map(len,words)).items()))", "input": "histogram_lengths(['a','to','be','cat',''])", "language": "Python", "predicted_output": "{0: 1, 1: 1, 2: 2, 3: 1}"}}
{"submissionId": "cmssudjwg0085g4p2lzdwiqn6", "title": "Submission DWIQN6", "payload": {"code": "def diagonal_sum(matrix):\n return sum(row[i] for i,row in enumerate(matrix) if i < len(row))", "input": "diagonal_sum([[2,9,1],[4,3],[7,8,5,6]])", "language": "Python", "predicted_output": "10"}}
{"submissionId": "cmssudjwg0086g4p2c02cdew6", "title": "Submission 2CDEW6", "payload": {"code": "def partition_threshold(values,t):\n low=[x for x in values if x<t]; high=[x for x in values if x>=t]\n return low,high", "input": "partition_threshold([5,1,7,3,5],5)", "language": "Python", "predicted_output": "([1, 3], [5, 7, 5])"}}
{"submissionId": "cmst1udzu00aqg4p2e3ir9cwg", "title": "Submission IR9CWG", "payload": {"code": "def collect(x, acc=[]):\n acc.append(x)\n return acc", "input": "(collect(1), collect(2), collect(3))", "language": "Python", "predicted_output": "([1, 2, 3], [1, 2, 3], [1, 2, 3])"}}
{"submissionId": "cmst1udzu00arg4p2rzcuuwl6", "title": "Submission CUUWL6", "payload": {"code": "def build():\n d = {}\n d['a'] = 1\n d['b'] = 2\n d['a'] = 3\n return list(d.items())", "input": "build()", "language": "Python", "predicted_output": "[('a', 3), ('b', 2)]"}}
{"submissionId": "cmst1udzu00asg4p2ktuvotwh", "title": "Submission UVOTWH", "payload": {"code": "def dm(a, b):\n return (a // b, a % b)", "input": "(dm(-7, 3), dm(7, -3))", "language": "Python", "predicted_output": "((-3, 2), (-3, -2))"}}
{"submissionId": "cmst1udzu00atg4p2upy8vf9i", "title": "Submission Y8VF9I", "payload": {"code": "def cmp(n):\n a = n\n b = int(str(n))\n return (a == b, a is b)", "input": "(cmp(256), cmp(257))", "language": "Python", "predicted_output": "((True, True), (True, False))"}}
{"submissionId": "cmst1udzv00aug4p2fz677u9a", "title": "Submission 677U9A", "payload": {"code": "def chained(seq):\n log = []\n def val(x):\n log.append(x)\n return x\n result = val(seq[0]) < val(seq[1]) < val(seq[2])\n return (result, log)", "input": "chained([1, 0, 5])", "language": "Python", "predicted_output": "(False, [1, 0])"}}
{"submissionId": "cmst1udzv00avg4p2xn85v05h", "title": "Submission 85V05H", "payload": {"code": "def splice(xs):\n xs[1:3] = [9, 9, 9]\n return xs", "input": "splice([0, 1, 2, 3])", "language": "Python", "predicted_output": "[0, 9, 9, 9, 3]"}}
{"submissionId": "cmst1udzv00awg4p2jo2mbawk", "title": "Submission 2MBAWK", "payload": {"code": "def make():\n fns = []\n for i in range(3):\n fns.append(lambda: i)\n return [f() for f in fns]", "input": "make()", "language": "Python", "predicted_output": "[2, 2, 2]"}}
{"submissionId": "cmst1udzv00axg4p2azmwoq3t", "title": "Submission MWOQ3T", "payload": {"code": "def order(pairs):\n return sorted(pairs, key=lambda p: p[0])", "input": "order([(1, 'a'), (0, 'b'), (1, 'c'), (0, 'd')])", "language": "Python", "predicted_output": "[(0, 'b'), (0, 'd'), (1, 'a'), (1, 'c')]"}}
{"submissionId": "cmst1udzv00ayg4p2bl2xhrtc", "title": "Submission 2XHRTC", "payload": {"code": "def dedup(xs):\n seen = set()\n out = []\n for x in xs:\n if x not in seen:\n seen.add(x)\n out.append(x)\n return out", "input": "dedup([3, 1, 3, 2, 1, 4])", "language": "Python", "predicted_output": "[3, 1, 2, 4]"}}
{"submissionId": "cmst1udzv00azg4p2qi2i2n6d", "title": "Submission 2I2N6D", "payload": {"code": "def rep(s, n):\n return (s * n, bool(s * n))", "input": "(rep('ab', 3), rep('x', 0))", "language": "Python", "predicted_output": "(('ababab', True), ('', False))"}}
{"submissionId": "cmst1udzv00b0g4p22eqs4joi", "title": "Submission QS4JOI", "payload": {"code": "def gen():\n log = []\n def g():\n for i in range(3):\n log.append(('yield', i))\n yield i * i\n squares = list(g())\n return (squares, log)", "input": "gen()", "language": "Python", "predicted_output": "([0, 1, 4], [('yield', 0), ('yield', 1), ('yield', 2)])"}}
{"submissionId": "cmst1udzv00b1g4p2gar9tz3g", "title": "Submission R9TZ3G", "payload": {"code": "def parse(items):\n out = []\n for it in items:\n try:\n out.append(int(it))\n except ValueError:\n out.append(None)\n return out", "input": "parse(['1', 'x', '3', ''])", "language": "Python", "predicted_output": "[1, None, 3, None]"}}
{"submissionId": "cmst1udzv00b2g4p28ls4u583", "title": "Submission S4U583", "payload": {"code": "def counts(text):\n c = {}\n for ch in text:\n c[ch] = c.get(ch, 0) + 1\n return sorted(c.items())", "input": "counts('banana')", "language": "Python", "predicted_output": "[('a', 3), ('b', 1), ('n', 2)]"}}
{"submissionId": "cmst1udzv00b3g4p2ujqji6zo", "title": "Submission QJI6ZO", "payload": {"code": "def split(xs):\n first, *middle, last = xs\n return (first, middle, last)", "input": "split([10, 20, 30, 40, 50])", "language": "Python", "predicted_output": "(10, [20, 30, 40], 50)"}}
{"submissionId": "cmst1udzv00b4g4p29yoco2m9", "title": "Submission OCO2M9", "payload": {"code": "def half(n):\n return (n / 2, n // 2)", "input": "(half(5), half(4))", "language": "Python", "predicted_output": "((2.5, 2), (2.0, 2))"}}
{"submissionId": "cmst1udzv00b5g4p21dbimg2s", "title": "Submission BIMG2S", "payload": {"code": "def pick(a, b):\n return (a or b, a and b)", "input": "(pick(0, 5), pick('x', ''))", "language": "Python", "predicted_output": "((5, 0), ('x', ''))"}}
{"submissionId": "cmst1udzv00b6g4p2efbcvcwr", "title": "Submission BCVCWR", "payload": {"code": "def grow(xs, s):\n xs.append(s)\n xs.extend(s)\n return xs", "input": "grow([], 'hi')", "language": "Python", "predicted_output": "['hi', 'h', 'i']"}}
{"submissionId": "cmst1udzv00b7g4p29phax3pj", "title": "Submission HAX3PJ", "payload": {"code": "def pairup(a, b):\n return [(i, x, y) for i, (x, y) in enumerate(zip(a, b), start=1)]", "input": "pairup([1, 2, 3, 4], ['a', 'b', 'c'])", "language": "Python", "predicted_output": "[(1, 1, 'a'), (2, 2, 'b'), (3, 3, 'c')]"}}
{"submissionId": "cmst1udzv00b8g4p2juewpe8o", "title": "Submission EWPE8O", "payload": {"code": "def rnd(xs):\n return [round(x) for x in xs]", "input": "rnd([0.5, 1.5, 2.5, 3.5])", "language": "Python", "predicted_output": "[0, 2, 2, 4]"}}
{"submissionId": "cmst1udzv00b9g4p2fphu3npc", "title": "Submission HU3NPC", "payload": {"code": "def alias():\n a = [1, 2, 3]\n b = a\n c = a[:]\n a.append(4)\n return (b, c)", "input": "alias()", "language": "Python", "predicted_output": "([1, 2, 3, 4], [1, 2, 3])"}}
{"submissionId": "cmst58o6y00ceg4p2ckihxdpc", "title": "Submission IHXDPC", "payload": {"code": "class Point:\n __slots__ = ('x', 'y')\n\n def __init__(self, x, y):\n self.x = x\n self.y = y\n\n\nclass Tagged(Point):\n pass\n\n\ndef slots_probe():\n report = []\n p = Point(1, 2)\n try:\n p.z = 3\n report.append('assigned')\n except AttributeError as exc:\n report.append(type(exc).__name__)\n report.append(hasattr(p, '__dict__'))\n t = Tagged(3, 4)\n t.z = 5\n report.append(hasattr(t, '__dict__'))\n report.append(t.z + t.x)\n report.append(Point.__slots__)\n return tuple(report)", "input": "slots_probe()", "language": "Python", "predicted_output": "('AttributeError', False, True, 8, ('x', 'y'))"}}
{"submissionId": "cmst58o6y00cfg4p2od2o36h3", "title": "Submission 2O36H3", "payload": {"code": "class Thermostat:\n def __init__(self, celsius):\n self._history = []\n self.celsius = celsius\n\n @property\n def celsius(self):\n return self._celsius\n\n @celsius.setter\n def celsius(self, value):\n self._celsius = max(0, min(40, value))\n self._history.append(self._celsius)\n\n @property\n def fahrenheit(self):\n return self._celsius * 9 / 5 + 32\n\n\ndef thermostat_run():\n t = Thermostat(55)\n t.celsius = -10\n t.celsius = 21\n locked = None\n try:\n t.fahrenheit = 100\n except AttributeError:\n locked = 'read-only'\n return (t.celsius, t.fahrenheit, t._history, locked)", "input": "thermostat_run()", "language": "Python", "predicted_output": "(21, 69.8, [40, 0, 21], 'read-only')"}}
{"submissionId": "cmst58o6y00cgg4p2naan9btd", "title": "Submission AN9BTD", "payload": {"code": "class Quiet:\n def __init__(self, *exc_types):\n self.exc_types = exc_types\n self.caught = None\n\n def __enter__(self):\n return self\n\n def __exit__(self, exc_type, exc, tb):\n if exc_type is not None and issubclass(exc_type, self.exc_types):\n self.caught = exc_type.__name__\n return True\n return False\n\n\ndef suppress_run():\n log = []\n q = Quiet(ValueError)\n with q:\n log.append('start')\n raise ValueError('bad')\n log.append('unreachable')\n log.append('after')\n log.append(q.caught)\n try:\n with Quiet(ValueError):\n raise KeyError('k')\n except KeyError as exc:\n log.append(exc.args[0])\n return log", "input": "suppress_run()", "language": "Python", "predicted_output": "['start', 'after', 'ValueError', 'k']"}}
{"submissionId": "cmst58o6y00chg4p2ibju1cgi", "title": "Submission JU1CGI", "payload": {"code": "from dataclasses import dataclass, field\n\n\n@dataclass(order=True)\nclass Task:\n priority: int\n name: str = field(compare=False)\n tags: list = field(default_factory=list, compare=False)\n\n\ndef task_run():\n a = Task(2, 'alpha')\n b = Task(2, 'beta', ['x'])\n c = Task(1, 'gamma')\n ordered = [t.name for t in sorted([a, b, c])]\n return (a == b, a < c, ordered, repr(c))", "input": "task_run()", "language": "Python", "predicted_output": "(True, False, ['gamma', 'alpha', 'beta'], \"Task(priority=1, name='gamma', tags=[])\")"}}
{"submissionId": "cmst58o6y00cig4p2jd6dfjp3", "title": "Submission 6DFJP3", "payload": {"code": "def make_counter():\n count = 0\n history = []\n\n def bump(step=1):\n nonlocal count\n count += step\n history.append(count)\n return count\n\n def reset():\n count = 0\n return count\n\n return bump, reset, (lambda: count), history\n\n\ndef counter_run():\n bump, reset, peek, history = make_counter()\n bump()\n bump(3)\n before = peek()\n returned = reset()\n return (before, returned, peek(), bump(0), history)", "input": "counter_run()", "language": "Python", "predicted_output": "(4, 0, 4, 4, [1, 4, 4])"}}
{"submissionId": "cmst58o6y00cjg4p2ohaiqbh4", "title": "Submission AIQBH4", "payload": {"code": "from collections import defaultdict\n\n\ndef build_groups(keys):\n calls = []\n\n def expensive(k):\n calls.append(k)\n return [k]\n\n plain = {}\n for k in keys:\n plain.setdefault(k, expensive(k)).append('p')\n\n dd = defaultdict(list)\n for k in keys:\n dd[k].append('d')\n\n return (plain, len(calls), calls, dict(dd), dd['zz'], len(dd))", "input": "build_groups(['a', 'b', 'a'])", "language": "Python", "predicted_output": "({'a': ['a', 'p', 'p'], 'b': ['b', 'p']}, 3, ['a', 'b', 'a'], {'a': ['d', 'd'], 'b': ['d']}, [], 3)"}}
{"submissionId": "cmst58o6y00ckg4p2hfyy988o", "title": "Submission YY988O", "payload": {"code": "def grid_report(rows, cols):\n shallow = [[0] * cols] * rows\n proper = [[0] * cols for _ in range(rows)]\n shallow[0][0] = 9\n proper[0][0] = 9\n row = [1, 2]\n row *= 2\n nested = [row]\n nested *= 2\n nested[0].append(7)\n return (shallow, proper, nested, nested[0] is nested[1], row is nested[1])", "input": "grid_report(2, 3)", "language": "Python", "predicted_output": "([[9, 0, 0], [9, 0, 0]], [[9, 0, 0], [0, 0, 0]], [[1, 2, 1, 2, 7], [1, 2, 1, 2, 7]], True, True)"}}
{"submissionId": "cmst58o6y00clg4p2n7uwnsn8", "title": "Submission UWNSN8", "payload": {"code": "def chain_probe(values):\n calls = []\n\n def mid(v):\n calls.append(v)\n return v\n\n results = []\n for v in values:\n results.append(1 < mid(v) < 10)\n short = 0 < mid(-5) < mid(99)\n return (results, calls, short)", "input": "chain_probe([5, 20])", "language": "Python", "predicted_output": "([True, False], [5, 20, -5], False)"}}
{"submissionId": "cmst58o6y00cmg4p2d7adiujo", "title": "Submission ADIUJO", "payload": {"code": "def identity_probe():\n small_a, small_b = 256, int('256')\n big_a, big_b = 257, int('257')\n neg_a, neg_b = -5, int('-5')\n far_a, far_b = -6, int('-6')\n return (\n (small_a == small_b, small_a is small_b),\n (big_a == big_b, big_a is big_b),\n (neg_a == neg_b, neg_a is neg_b),\n (far_a == far_b, far_a is far_b),\n )", "input": "identity_probe()", "language": "Python", "predicted_output": "((True, True), (True, False), (True, True), (True, False))"}}
{"submissionId": "cmst58o6y00cng4p2gcpv0qew", "title": "Submission PV0QEW", "payload": {"code": "def rank(records):\n by_tuple = [r['name'] for r in sorted(records, key=lambda r: (r['score'], r['name']))]\n reversed_all = [r['name'] for r in sorted(records, key=lambda r: (r['score'], r['name']), reverse=True)]\n negated = [r['name'] for r in sorted(records, key=lambda r: (-r['score'], r['name']))]\n ties_kept = [r['name'] for r in sorted(records, key=lambda r: r['score'], reverse=True)]\n return (by_tuple, reversed_all, negated, ties_kept)", "input": "rank([{'name': 'ana', 'score': 3}, {'name': 'bo', 'score': 1}, {'name': 'cy', 'score': 3}, {'name': 'al', 'score': 3}])", "language": "Python", "predicted_output": "(['bo', 'al', 'ana', 'cy'], ['cy', 'ana', 'al', 'bo'], ['al', 'ana', 'cy', 'bo'], ['ana', 'cy', 'al', 'bo'])"}}
{"submissionId": "cmst58o6y00cog4p27c04pk9j", "title": "Submission 04PK9J", "payload": {"code": "def normalize(text):\n table = str.maketrans({'a': '4', 'e': None, 'l': 'LL', ' ': '_'})\n strict = text.translate(table)\n fallback = text.translate(str.maketrans('abc', 'xyz', 'd'))\n return (strict, fallback, len(strict), text.translate({}) == text)", "input": "normalize('ale bead')", "language": "Python", "predicted_output": "('4LL_b4d', 'xle yex', 7, True)"}}
{"submissionId": "cmst58o6y00cpg4p2wr5hjruj", "title": "Submission 5HJRUJ", "payload": {"code": "def accumulator(start=0):\n total = start\n received = []\n while True:\n value = yield total\n if value is None:\n received.append('none')\n continue\n total += value\n received.append(value)\n if total > 100:\n return received\n\n\ndef drive(steps):\n gen = accumulator(10)\n seen = [next(gen)]\n ended = None\n for s in steps:\n try:\n seen.append(gen.send(s))\n except StopIteration as stop:\n ended = stop.value\n break\n return (seen, ended)", "input": "drive([5, 20, None, 70])", "language": "Python", "predicted_output": "([10, 15, 35, 35], [5, 20, 'none', 70])"}}
{"submissionId": "cmst58o6y00cqg4p2su3ut2cn", "title": "Submission 3UT2CN", "payload": {"code": "from itertools import islice, tee\n\n\ndef split_probe(source):\n it = iter(source)\n first = next(it)\n a, b = tee(it, 2)\n head_a = list(islice(a, 2))\n stolen = next(it)\n head_b = list(islice(b, 2))\n rest_a = list(a)\n rest_b = list(b)\n return (first, head_a, head_b, stolen, rest_a, rest_b, stolen in rest_b)", "input": "split_probe([1, 2, 3, 4, 5, 6, 7])", "language": "Python", "predicted_output": "(1, [2, 3], [2, 3], 4, [5, 6, 7], [5, 6, 7], False)"}}
{"submissionId": "cmst58o6y00crg4p2x4jnu947", "title": "Submission JNU947", "payload": {"code": "from itertools import zip_longest\n\n\ndef merge(names, scores):\n padded = ['{}:{}'.format(n, s) for n, s in zip_longest(names, scores, fillvalue='?')]\n truncated = list(zip(names, scores))\n numeric = dict(zip_longest(names, scores, fillvalue=0))\n default_fill = list(zip_longest(names, scores))\n return (padded, len(truncated), numeric, default_fill[-1])", "input": "merge(['a', 'b', 'c'], [1, 2])", "language": "Python", "predicted_output": "(['a:1', 'b:2', 'c:?'], 2, {'a': 1, 'b': 2, 'c': 0}, ('c', None))"}}
{"submissionId": "cmst58o6y00csg4p2tihi23ya", "title": "Submission HI23YA", "payload": {"code": "from functools import partial\n\n\ndef report(label, *values, sep='-', upper=False):\n body = sep.join(str(v) for v in values)\n text = '{}{}{}'.format(label, sep, body)\n return text.upper() if upper else text\n\n\ndef partial_run():\n p1 = partial(report, 'head')\n p2 = partial(report, sep='|')\n p3 = partial(p1, 1, 2, upper=True)\n a = p1(1, 2)\n b = p2('x', 9, sep='+')\n c = p3(3)\n d = partial(report, 'A', 'B')('C')\n return (a, b, c, d, p3.args, p1.func is report)", "input": "partial_run()", "language": "Python", "predicted_output": "('head-1-2', 'x+9', 'HEAD-1-2-3', 'A-B-C', ('head', 1, 2), True)"}}
{"submissionId": "cmst58o6y00ctg4p2gt67dvhy", "title": "Submission 67DVHY", "payload": {"code": "class Tracker:\n def __init__(self):\n self.data = {'x': 1}\n self.hits = []\n\n def __getattr__(self, name):\n self.hits.append(('missing', name))\n if name in self.data:\n return self.data[name]\n raise AttributeError(name)\n\n\nclass Loud:\n def __init__(self):\n object.__setattr__(self, 'log', [])\n object.__setattr__(self, 'real', 7)\n\n def __getattribute__(self, name):\n object.__getattribute__(self, 'log').append(name)\n if name == 'real':\n return 'intercepted'\n return object.__getattribute__(self, name)\n\n def __getattr__(self, name):\n return 'fallback:' + name\n\n\ndef attr_run():\n t = Tracker()\n got = (t.x, t.data['x'])\n err = None\n try:\n t.nope\n except AttributeError as exc:\n err = exc.args[0]\n hits = list(t.hits)\n lo = Loud()\n values = (lo.real, lo.missing)\n raw = object.__getattribute__(lo, 'real')\n return (got, hits, err, values, raw, lo.log)", "input": "attr_run()", "language": "Python", "predicted_output": "((1, 1), [('missing', 'x'), ('missing', 'nope')], 'nope', ('intercepted', 'fallback:missing'), 7, ['real', 'missing', 'log'])"}}
{"submissionId": "cmst58o6y00cug4p2kjybo9y3", "title": "Submission YBO9Y3", "payload": {"code": "def build_config():\n scale = 10\n\n class Config:\n base = [1, 2, 3]\n doubled = [v * 2 for v in base]\n scaled = [v * scale for v in base]\n try:\n widths = [v * len(base) for v in base]\n except NameError as exc:\n widths = type(exc).__name__\n\n return (Config.doubled, Config.scaled, Config.widths, [v * len(Config.base) for v in Config.base])", "input": "build_config()", "language": "Python", "predicted_output": "([2, 4, 6], [10, 20, 30], 'NameError', [3, 6, 9])"}}
{"submissionId": "cmst58o6y00cvg4p2utz2o1cm", "title": "Submission Z2O1CM", "payload": {"code": "def explicit(raw):\n try:\n return int(raw)\n except ValueError as exc:\n raise TypeError('bad literal') from exc\n\n\ndef implicit(raw):\n try:\n return int(raw)\n except ValueError:\n raise TypeError('implicit')\n\n\ndef cleaned(raw):\n try:\n return int(raw)\n except ValueError:\n raise TypeError('clean') from None\n\n\ndef inspect(fn, raw):\n try:\n fn(raw)\n except TypeError as exc:\n cause = type(exc.__cause__).__name__ if exc.__cause__ is not None else None\n context = type(exc.__context__).__name__ if exc.__context__ is not None else None\n return (exc.args[0], cause, context, exc.__suppress_context__)\n return 'no error'\n\n\ndef chain_report():\n return (inspect(explicit, 'x'), inspect(implicit, 'x'), inspect(cleaned, 'x'), inspect(explicit, '7'))", "input": "chain_report()", "language": "Python", "predicted_output": "(('bad literal', 'ValueError', 'ValueError', True), ('implicit', None, 'ValueError', False), ('clean', None, 'ValueError', True), 'no error')"}}
{"submissionId": "cmst58o6y00cwg4p23cwyu10o", "title": "Submission WYU10O", "payload": {"code": "class Money:\n def __init__(self, cents):\n self.cents = cents\n\n def __add__(self, other):\n if isinstance(other, Money):\n return Money(self.cents + other.cents)\n if isinstance(other, int):\n return Money(self.cents + other)\n return NotImplemented\n\n def __radd__(self, other):\n return Money(self.cents + other + 1000)\n\n def __repr__(self):\n return 'Money({})'.format(self.cents)\n\n\nclass Premium(Money):\n def __radd__(self, other):\n return Money(self.cents * 2)\n\n\ndef money_run():\n a = Money(50)\n left = a + 5\n right = 5 + a\n total = sum([Money(1), Money(2)], Money(0))\n mixed = Money(10) + Premium(3)\n reflected = 7 + Premium(3)\n err = None\n try:\n Money(1) + 'x'\n except TypeError:\n err = 'TypeError'\n return (left, right, total, mixed, reflected, err)", "input": "money_run()", "language": "Python", "predicted_output": "(Money(55), Money(1055), Money(3), Money(6), Money(6), 'TypeError')"}}
{"submissionId": "cmst58o6y00cxg4p23x6wiu7d", "title": "Submission 6WIU7D", "payload": {"code": "def combine(base, extra):\n left = base | extra\n right = extra | base\n inplace = dict(base)\n inplace |= extra\n from_pairs = dict(base)\n from_pairs |= [('z', 9), ('a', 0)]\n err = None\n try:\n base | [('q', 1)]\n except TypeError:\n err = 'TypeError'\n return (left, right, inplace, from_pairs, base, left is base, err)", "input": "combine({'a': 1, 'b': 2}, {'b': 20, 'c': 3})", "language": "Python", "predicted_output": "({'a': 1, 'b': 20, 'c': 3}, {'b': 2, 'c': 3, 'a': 1}, {'a': 1, 'b': 20, 'c': 3}, {'a': 0, 'b': 2, 'z': 9}, {'a': 1, 'b': 2}, False, 'TypeError')"}}
{"submissionId": "cmsu44b3l00f8g4p2s7gzhuxm", "title": "Submission GZHUXM", "payload": {"code": "def dedupe_runs(values):\n out = []\n for value in values:\n if not out or out[-1] != value:\n out.append(value)\n return out, len(values) - len(out)", "input": "dedupe_runs([1, 1, 2, 2, 2, 1, 3, 3])", "language": "Python", "predicted_output": "([1, 2, 1, 3], 4)"}}
{"submissionId": "cmsu44b3l00f9g4p23xc4r2s1", "title": "Submission C4R2S1", "payload": {"code": "def rotate(matrix):\n return [list(row) for row in zip(*matrix[::-1])]", "input": "rotate([[1, 2], [3, 4], [5, 6]])", "language": "Python", "predicted_output": "[[5, 3, 1], [6, 4, 2]]"}}
{"submissionId": "cmsu44b3l00fag4p2bor4o7ht", "title": "Submission R4O7HT", "payload": {"code": "def chunk_budget(costs, budget):\n batches = []\n current = []\n running = 0\n for cost in costs:\n if running + cost > budget and current:\n batches.append(current)\n current = []\n running = 0\n current.append(cost)\n running += cost\n if current:\n batches.append(current)\n return batches", "input": "chunk_budget([4, 3, 5, 1, 9, 2], 8)", "language": "Python", "predicted_output": "[[4, 3], [5, 1], [9], [2]]"}}
{"submissionId": "cmsu44b3l00fbg4p2tsyrd4v8", "title": "Submission YRD4V8", "payload": {"code": "class Counter:\n def __init__(self, start=0):\n self.value = start\n def __iadd__(self, other):\n self.value += other\n return self\n def __repr__(self):\n return 'Counter({})'.format(self.value)\n\ndef demo():\n a = Counter(1)\n b = a\n a += 5\n return a, b, a is b", "input": "demo()", "language": "Python", "predicted_output": "(Counter(6), Counter(6), True)"}}
{"submissionId": "cmsu44b3l00fcg4p2f8jsdzos", "title": "Submission JSDZOS", "payload": {"code": "def walk(tree, depth=0):\n if not isinstance(tree, dict):\n return [(depth, tree)]\n found = []\n for key in sorted(tree):\n found.append((depth, key))\n found.extend(walk(tree[key], depth + 1))\n return found", "input": "walk({'b': {'d': 1}, 'a': 2})", "language": "Python", "predicted_output": "[(0, 'a'), (1, 2), (0, 'b'), (1, 'd'), (2, 1)]"}}
{"submissionId": "cmsudv4e800fsg4p20136xcoq", "title": "Submission 36XCOQ", "payload": {"code": "def reorder_report(stock, thresholds):\n report = []\n for sku in sorted(stock):\n on_hand = stock[sku]\n floor = thresholds.get(sku, 10)\n if on_hand < floor:\n report.append((sku, floor - on_hand))\n return report", "input": "reorder_report({\"axe\": 3, \"bolt\": 40, \"cog\": 10}, {\"axe\": 12, \"cog\": 10})", "language": "Python", "predicted_output": "[('axe', 9)]"}}
{"submissionId": "cmsudv4e800ftg4p2p3szc8us", "title": "Submission SZC8US", "payload": {"code": "def backoff_schedule(attempts, base, ceiling):\n delays = []\n delay = base\n for _ in range(attempts):\n delays.append(min(delay, ceiling))\n delay *= 2\n return delays", "input": "backoff_schedule(6, 3, 20)", "language": "Python", "predicted_output": "[3, 6, 12, 20, 20, 20]"}}
{"submissionId": "cmsudv4e800fug4p2t4jrfh01", "title": "Submission JRFH01", "payload": {"code": "def rank_versions(tags):\n def key(tag):\n return tuple(int(part) for part in tag.lstrip(\"v\").split(\".\"))\n ordered = sorted(tags, key=key, reverse=True)\n return ordered[0], ordered[-1]", "input": "rank_versions([\"v1.9.0\", \"v1.10.2\", \"v1.2.30\", \"v1.10.10\"])", "language": "Python", "predicted_output": "('v1.10.10', 'v1.2.30')"}}
{"submissionId": "cmsudv4e800fvg4p2jhkwqits", "title": "Submission KWQITS", "payload": {"code": "from collections import deque\n\ndef peak_window(readings, width):\n window = deque(maxlen=width)\n peaks = []\n for value in readings:\n window.append(value)\n if len(window) == width:\n peaks.append(max(window))\n return peaks", "input": "peak_window([4, 1, 7, 3, 3, 9], 3)", "language": "Python", "predicted_output": "[7, 7, 7, 9]"}}
{"submissionId": "cmsudv4e800fwg4p2ydm82nni", "title": "Submission M82NNI", "payload": {"code": "def merge_spans(spans):\n merged = []\n for start, end in sorted(spans):\n if merged and start <= merged[-1][1]:\n previous_start, previous_end = merged[-1]\n merged[-1] = (previous_start, max(previous_end, end))\n else:\n merged.append((start, end))\n return merged", "input": "merge_spans([(5, 8), (1, 3), (2, 6), (11, 12)])", "language": "Python", "predicted_output": "[(1, 8), (11, 12)]"}}
{"submissionId": "cmsudv4e800fxg4p2i9agi3rr", "title": "Submission AGI3RR", "payload": {"code": "class QuotaError(Exception):\n pass\n\ndef consume(units, budget):\n trail = []\n try:\n if units > budget:\n raise QuotaError(\"over budget\")\n trail.append(\"charged\")\n return trail\n except QuotaError as exc:\n trail.append(\"denied:\" + str(exc))\n return trail\n finally:\n trail.append(\"audited\")", "input": "(consume(3, 10), consume(30, 10))", "language": "Python", "predicted_output": "(['charged', 'audited'], ['denied:over budget', 'audited'])"}}
{"submissionId": "cmsudv4e800fyg4p2hq4mv57s", "title": "Submission 4MV57S", "payload": {"code": "import itertools\n\ndef first_stable(readings, tolerance):\n pairs = zip(readings, readings[1:])\n steady = (a for a, b in pairs if abs(a - b) <= tolerance)\n return list(itertools.islice(steady, 2))", "input": "first_stable([10, 11, 30, 31, 31, 80], 1)", "language": "Python", "predicted_output": "[10, 30]"}}
{"submissionId": "cmsudv4e800fzg4p2ogxn6tr8", "title": "Submission XN6TR8", "payload": {"code": "from collections import Counter\n\ndef top_endpoints(paths, limit):\n counts = Counter(paths)\n return counts.most_common(limit)", "input": "top_endpoints([\"/a\", \"/b\", \"/a\", \"/c\", \"/b\", \"/a\"], 2)", "language": "Python", "predicted_output": "[('/a', 3), ('/b', 2)]"}}
{"submissionId": "cmsudv4e800g0g4p2oeq8zi6i", "title": "Submission Q8ZI6I", "payload": {"code": "def split_object_key(key):\n prefix, separator, name = key.rpartition(\"/\")\n stem, dot, extension = name.partition(\".\")\n return prefix, stem, extension or \"none\"", "input": "split_object_key(\"templates/2026/report.final.docx\")", "language": "Python", "predicted_output": "('templates/2026', 'report', 'final.docx')"}}
{"submissionId": "cmsudv4e800g1g4p21z2j6rz1", "title": "Submission 2J6RZ1", "payload": {"code": "def make_collector():\n def collect(entry, sink=[]):\n sink.append(entry)\n return list(sink)\n return collect\n\ndef audit_trail():\n collect = make_collector()\n first = collect(\"open\")\n second = collect(\"close\")\n return first, second", "input": "audit_trail()", "language": "Python", "predicted_output": "(['open'], ['open', 'close'])"}}
{"submissionId": "cmsudv4e800g2g4p22kplf9sg", "title": "Submission PLF9SG", "payload": {"code": "from functools import lru_cache\n\ndef probe():\n @lru_cache(maxsize=None)\n def steps(n):\n if n < 2:\n return n\n return steps(n - 1) + steps(n - 2)\n\n value = steps(10)\n info = steps.cache_info()\n return value, info.hits, info.misses", "input": "probe()", "language": "Python", "predicted_output": "(55, 8, 11)"}}
{"submissionId": "cmsudv4e800g3g4p2f58pro0n", "title": "Submission 8PRO0N", "payload": {"code": "def round_half_even(values):\n return [round(value) for value in values]", "input": "round_half_even([0.5, 1.5, 2.5, -0.5, -1.5])", "language": "Python", "predicted_output": "[0, 2, 2, 0, -2]"}}
{"submissionId": "cmsudv4e800g4g4p2na06pi29", "title": "Submission 06PI29", "payload": {"code": "def clock_offsets(offsets, period):\n return [(offset // period, offset % period) for offset in offsets]", "input": "clock_offsets([7, -7, 0, -1], 3)", "language": "Python", "predicted_output": "[(2, 1), (-3, 2), (0, 0), (-1, 2)]"}}
{"submissionId": "cmsudv4e800g5g4p24eveh8ou", "title": "Submission VEH8OU", "payload": {"code": "def splice(rows, start, stop, replacement):\n copy = list(rows)\n copy[start:stop] = replacement\n return copy, len(copy)", "input": "splice([1, 2, 3, 4, 5], 1, 4, ['x'])", "language": "Python", "predicted_output": "([1, 'x', 5], 3)"}}
{"submissionId": "cmsudv4e800g6g4p2zthh04b4", "title": "Submission HH04B4", "payload": {"code": "def index_by_initial(names):\n index = {}\n for name in names:\n index.setdefault(name[0], []).append(name)\n return index", "input": "index_by_initial([\"ana\", \"arun\", \"bo\", \"ada\"])", "language": "Python", "predicted_output": "{'a': ['ana', 'arun', 'ada'], 'b': ['bo']}"}}
{"submissionId": "cmsudv4e800g7g4p20aovw49a", "title": "Submission OVW49A", "payload": {"code": "def format_ids(raw_ids, width):\n return [str(raw).zfill(width) for raw in raw_ids]", "input": "format_ids([7, 42, 12345], 4)", "language": "Python", "predicted_output": "['0007', '0042', '12345']"}}
{"submissionId": "cmsudv4e800g8g4p22iz4bwny", "title": "Submission Z4BWNY", "payload": {"code": "def sort_tickets(tickets):\n return sorted(tickets, key=lambda ticket: ticket[1])", "input": "sort_tickets([(\"a\", 2), (\"b\", 1), (\"c\", 2), (\"d\", 1)])", "language": "Python", "predicted_output": "[('b', 1), ('d', 1), ('a', 2), ('c', 2)]"}}
{"submissionId": "cmsudv4e800g9g4p2jhyyq71r", "title": "Submission YYQ71R", "payload": {"code": "import itertools\n\ndef align(expected, actual):\n return list(itertools.zip_longest(expected, actual, fillvalue=\"-\"))", "input": "align([\"a\", \"b\", \"c\"], [\"a\", \"b\"])", "language": "Python", "predicted_output": "[('a', 'a'), ('b', 'b'), ('c', '-')]"}}
{"submissionId": "cmsudv4e800gag4p2hx7o7a38", "title": "Submission 7O7A38", "payload": {"code": "def commit(value):\n log = []\n try:\n log.append(\"try\")\n return log + [\"from-try\"]\n finally:\n log.append(\"finally\")\n\ndef observe():\n return commit(1)", "input": "observe()", "language": "Python", "predicted_output": "['try', 'from-try']"}}
{"submissionId": "cmsudv4e800gbg4p27e5ydfek", "title": "Submission 5YDFEK", "payload": {"code": "import bisect\n\ndef insert_sorted(scores, incoming):\n ordered = list(scores)\n positions = []\n for score in incoming:\n position = bisect.bisect_left(ordered, score)\n ordered.insert(position, score)\n positions.append(position)\n return ordered, positions", "input": "insert_sorted([10, 20, 30], [25, 10, 40])", "language": "Python", "predicted_output": "([10, 10, 20, 25, 30, 40], [2, 0, 5])"}}
{"submissionId": "cmsugy1v400h6g4p2etkow937", "title": "Submission KOW937", "payload": {"code": "from collections import defaultdict\n\ndef group_by_parity(nums):\n groups = defaultdict(list)\n for n in nums:\n groups['even' if n % 2 == 0 else 'odd'].append(n)\n return dict(groups)", "input": "group_by_parity([1, 2, 3, 4, 5, 6])", "language": "Python", "predicted_output": "{'odd': [1, 3, 5], 'even': [2, 4, 6]}"}}
{"submissionId": "cmsugy75f00h7g4p24asmp0ij", "title": "Submission SMP0IJ", "payload": {"code": "def append_to(value, target=[]):\n target.append(value)\n return target", "input": "(append_to(1), append_to(2), append_to(3, []))", "language": "Python", "predicted_output": "([1, 2], [1, 2], [3])"}}
{"submissionId": "cmsugyc7500h8g4p2pos2w3r5", "title": "Submission S2W3R5", "payload": {"code": "def process(value):\n log = []\n try:\n if value < 0:\n raise ValueError('negative')\n log.append(f'ok:{value}')\n except ValueError as e:\n log.append(f'error:{e}')\n finally:\n log.append('cleanup')\n return log", "input": "process(-5)", "language": "Python", "predicted_output": "['error:negative', 'cleanup']"}}
{"submissionId": "cmsugyyxj00h9g4p27pp67ty2", "title": "Submission P67TY2", "payload": {"code": "def fib(n, memo={}):\n if n in memo:\n return memo[n]\n if n < 2:\n result = n\n else:\n result = fib(n-1, memo) + fib(n-2, memo)\n memo[n] = result\n return result", "input": "list(map(fib, range(10)))", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]"}}
{"submissionId": "cmsugz5aa00hag4p2elyqi4pe", "title": "Submission YQI4PE", "payload": {"code": "import itertools\n\ndef flatten_gen(nested):\n for item in nested:\n if isinstance(item, list):\n yield from flatten_gen(item)\n else:\n yield item", "input": "list(itertools.islice(flatten_gen([1, [2, 3], [4, [5, 6]], 7]), 10))", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7]"}}
{"submissionId": "cmsuhgank00jhg4p2xcieo4ea", "title": "Submission IEO4EA", "payload": {"code": "def format_report(name, score):\n grade = 'A' if score >= 90 else ('B' if score >= 80 else 'C')\n return f\"{name}: {score} ({grade})\"", "input": "format_report(\"Alice\", 92)", "language": "Python", "predicted_output": "Alice: 92 (A)"}}
{"submissionId": "cmsuhgank00jig4p24gujpqsm", "title": "Submission UJPQSM", "payload": {"code": "def factorial_acc(n, acc=1):\n if n <= 1:\n return acc\n return factorial_acc(n - 1, acc * n)", "input": "factorial_acc(6)", "language": "Python", "predicted_output": "720"}}
{"submissionId": "cmsuhgank00jjg4p2xeci78be", "title": "Submission CI78BE", "payload": {"code": "def set_ops(a, b):\n return (sorted(a & b), sorted(a | b), sorted(a - b))", "input": "set_ops({1, 2, 3}, {2, 3, 4})", "language": "Python", "predicted_output": "([2, 3], [1, 2, 3, 4], [1])"}}
{"submissionId": "cmsuhgank00jkg4p2xl514f3s", "title": "Submission 514F3S", "payload": {"code": "def reverse_words(s):\n return ' '.join(s.split()[::-1])", "input": "reverse_words(\"the quick brown fox\")", "language": "Python", "predicted_output": "fox brown quick the"}}
{"submissionId": "cmsuhgank00jlg4p23bsvtw29", "title": "Submission SVTW29", "payload": {"code": "class Point:\n def __init__(self, x, y):\n self.x = x\n self.y = y\n def __repr__(self):\n return f\"Point({self.x}, {self.y})\"\n def __eq__(self, other):\n return self.x == other.x and self.y == other.y\n def __add__(self, other):\n return Point(self.x + other.x, self.y + other.y)", "input": "Point(1, 2) + Point(3, 4)", "language": "Python", "predicted_output": "Point(4, 6)"}}
{"submissionId": "cmsuj9zm400lrg4p2hq6v1apu", "title": "Submission 6V1APU", "payload": {"code": "def dedupe_preserve_order(items):\n seen = set()\n result = []\n for x in items:\n if x not in seen:\n seen.add(x)\n result.append(x)\n return result", "input": "dedupe_preserve_order([3, 1, 3, 2, 1, 4])", "language": "Python", "predicted_output": "[3, 1, 2, 4]"}}
{"submissionId": "cmsuj9zm400lsg4p2y5ck4p68", "title": "Submission CK4P68", "payload": {"code": "def chunk_list(lst, size):\n return [lst[i:i+size] for i in range(0, len(lst), size)]", "input": "chunk_list([1,2,3,4,5,6,7], 3)", "language": "Python", "predicted_output": "[[1, 2, 3], [4, 5, 6], [7]]"}}
{"submissionId": "cmsuj9zm400ltg4p2bdlpv7oe", "title": "Submission LPV7OE", "payload": {"code": "def try_parse_int(values):\n results = []\n for v in values:\n try:\n results.append(int(v))\n except ValueError:\n results.append(None)\n return results", "input": "try_parse_int(['42', 'abc', '-7', '3.5'])", "language": "Python", "predicted_output": "[42, None, -7, None]"}}
{"submissionId": "cmsuj9zm400lug4p2c6xtv3u7", "title": "Submission XTV3U7", "payload": {"code": "class Counter2:\n def __init__(self):\n self.counts = {}\n def add(self, key):\n self.counts[key] = self.counts.get(key, 0) + 1\n return self.counts[key]\n\ndef run_trace():\n c = Counter2()\n results = [c.add('a'), c.add('b'), c.add('a'), c.add('a')]\n return results", "input": "run_trace()", "language": "Python", "predicted_output": "[1, 1, 2, 3]"}}
{"submissionId": "cmsuj9zm400lvg4p2ssgoys0m", "title": "Submission GOYS0M", "payload": {"code": "def flatten_one_level(nested):\n result = []\n for item in nested:\n if isinstance(item, list):\n result.extend(item)\n else:\n result.append(item)\n return result", "input": "flatten_one_level([1, [2, 3], [4, [5, 6]], 7])", "language": "Python", "predicted_output": "[1, 2, 3, 4, [5, 6], 7]"}}
{"submissionId": "cmsupb4pg011rg4p2jd6gu5m5", "title": "Submission 6GU5M5", "payload": {"code": "from collections import defaultdict\n\ndef bucket_by_grade(entries, curve=0):\n buckets = defaultdict(list)\n for name, score in entries:\n try:\n adjusted = score + curve\n if adjusted >= 90:\n grade = \"A\"\n elif adjusted >= 80:\n grade = \"B\"\n elif adjusted >= 70:\n grade = \"C\"\n else:\n grade = \"F\"\n except TypeError:\n grade = \"invalid\"\n buckets[grade].append(name)\n return dict(buckets)", "input": "bucket_by_grade([(\"Alice\", 85), (\"Bob\", 72), (\"Carol\", 66), (\"Dave\", \"absent\"), (\"Eve\", 95)], curve=5)", "language": "Python", "predicted_output": "{'A': ['Alice', 'Eve'], 'C': ['Bob', 'Carol'], 'invalid': ['Dave']}"}}
{"submissionId": "cmsupb4pg011sg4p2xwqfwhdh", "title": "Submission QFWHDH", "payload": {"code": "def parse_config_lines(lines):\n parsed = {}\n errors = []\n for line_no, raw_line in enumerate(lines, start=1):\n line = raw_line.strip()\n if not line or line.startswith(\"#\"):\n continue\n try:\n key, value = line.split(\"=\", 1)\n except ValueError:\n errors.append(f\"line {line_no}: missing '='\")\n continue\n key = key.strip()\n value = value.strip()\n if not key:\n errors.append(f\"line {line_no}: empty key\")\n continue\n if value.lstrip(\"-\").isdigit():\n value = int(value)\n parsed[key] = value\n return parsed, errors", "input": "parse_config_lines([\"# config file\", \"\", \"timeout=30\", \"retries=-5\", \"path=/usr/local/bin=extra\", \"bad_line_no_equals\", \" = orphan_value\", \"timeout=60\"])", "language": "Python", "predicted_output": "({'timeout': 60, 'retries': -5, 'path': '/usr/local/bin=extra'}, [\"line 6: missing '='\", 'line 7: empty key'])"}}
{"submissionId": "cmsv70ftv018sg4p2ydw8qxyh", "title": "Submission W8QXYH", "payload": {"code": "def make_counter(start=0):\n count = start\n def increment(step=1):\n nonlocal count\n count += step\n return count\n return increment\n\ndef run_sequence():\n c = make_counter()\n return [c(), c(2), c()]", "input": "(make_counter(10)(), make_counter(10)(5), run_sequence())", "language": "Python", "predicted_output": "(11, 15, [1, 3, 4])"}}
{"submissionId": "cmsv70uct018yg4p2nrepmjek", "title": "Submission EPMJEK", "payload": {"code": "def echo_transform():\n total = 0\n while True:\n received = yield total\n if received is None:\n break\n total += received\n\ndef run_generator():\n g = echo_transform()\n first = next(g)\n second = g.send(3)\n third = g.send(4)\n return [first, second, third]", "input": "run_generator()", "language": "Python", "predicted_output": "[0, 3, 7]"}}
{"submissionId": "cmsv71a440194g4p2s11o4zmh", "title": "Submission 1O4ZMH", "payload": {"code": "def make_counter():\n count = [0]\n def increment(step=1):\n count[0] += step\n return count[0]\n return increment\n\nc1 = make_counter()", "input": "(c1(), c1(5), c1())", "language": "Python", "predicted_output": "(1, 6, 7)"}}
{"submissionId": "cmsv71k7s0199g4p2mur1623v", "title": "Submission R1623V", "payload": {"code": "def tag_event(event, log={}):\n log.setdefault(event, 0)\n log[event] += 1\n return dict(log)", "input": "(tag_event('start'), tag_event('start'), tag_event('stop'), tag_event('start', {}))", "language": "Python", "predicted_output": "({'start': 1}, {'start': 2}, {'start': 2, 'stop': 1}, {'start': 1})"}}
{"submissionId": "cmsv72054019hg4p2ibr1t678", "title": "Submission R1T678", "payload": {"code": "def counter_decorator(func):\n func.calls = 0\n def wrapper(*args, **kwargs):\n func.calls += 1\n wrapper.calls = func.calls\n return func(*args, **kwargs)\n return wrapper\n\ndef upper_decorator(func):\n def wrapper(*args, **kwargs):\n result = func(*args, **kwargs)\n return result.upper() if isinstance(result, str) else result\n return wrapper\n\n@counter_decorator\n@upper_decorator\ndef greet(name):\n return f\"hello {name}\"\n", "input": "(greet('ann'), greet('bo'), greet.calls)", "language": "Python", "predicted_output": "('HELLO ANN', 'HELLO BO', 2)"}}
{"submissionId": "cmsv72ekl019qg4p2g385f8z6", "title": "Submission 85F8Z6", "payload": {"code": "def compute(x):\n try:\n if x == 0:\n raise ValueError(\"zero\")\n return x * 2\n except ValueError:\n return -1\n finally:\n if x == 0:\n return 99", "input": "(compute(5), compute(0))", "language": "Python", "predicted_output": "(10, 99)"}}
{"submissionId": "cmsv740si01a6g4p2i1o0j120", "title": "Submission O0J120", "payload": {"code": "def make_funcs():\n return [lambda: i for i in range(4)]\n\ndef call_all(funcs):\n return [f() for f in funcs]", "input": "call_all(make_funcs())", "language": "Python", "predicted_output": "[3, 3, 3, 3]"}}
{"submissionId": "cmsv74ghl01agg4p2p4hav0es", "title": "Submission HAV0ES", "payload": {"code": "def build_map(pairs):\n return {k % 3: v for k, v in pairs}", "input": "build_map([(1, 'a'), (4, 'b'), (7, 'c'), (2, 'd')])", "language": "Python", "predicted_output": "{1: 'c', 2: 'd'}"}}
{"submissionId": "cmsv752v501aqg4p24htm4s5x", "title": "Submission TM4S5X", "payload": {"code": "def format_report(value, width):\n return f\"{value:>{width}.2f}|{value:+.1e}|{value!r}\"\n", "input": "format_report(-3.14159, 10)", "language": "Python", "predicted_output": " -3.14|-3.1e+00|-3.14159"}}
{"submissionId": "cmsv75fnt01b1g4p2fgtsy27t", "title": "Submission TSY27T", "payload": {"code": "import functools\n\ncalls = []\n\n@functools.lru_cache(maxsize=None)\ndef fib(n):\n calls.append(n)\n if n < 2:\n return n\n return fib(n - 1) + fib(n - 2)\n", "input": "(fib(7), len(calls))", "language": "Python", "predicted_output": "(13, 8)"}}
{"submissionId": "cmsv75x1v01bbg4p2drp84f21", "title": "Submission P84F21", "payload": {"code": "import itertools\n\ndef group_consecutive(items):\n return [(k, list(g)) for k, g in itertools.groupby(items)]", "input": "group_consecutive([1, 1, 2, 1, 1, 3, 3])", "language": "Python", "predicted_output": "[(1, [1, 1]), (2, [2]), (1, [1, 1]), (3, [3, 3])]"}}
{"submissionId": "cmsv76bxg01bmg4p2ktz0uxh4", "title": "Submission Z0UXH4", "payload": {"code": "def make_funcs_fixed():\n return [lambda i=i: i for i in range(4)]\n\ndef call_all(funcs):\n return [f() for f in funcs]", "input": "call_all(make_funcs_fixed())", "language": "Python", "predicted_output": "[0, 1, 2, 3]"}}
{"submissionId": "cmsv76pvm01bwg4p2dpnvi346", "title": "Submission NVI346", "payload": {"code": "def scoping_demo():\n x = 10\n gen = (x + i for i in range(3))\n x = 100\n return list(gen)", "input": "scoping_demo()", "language": "Python", "predicted_output": "[100, 101, 102]"}}
{"submissionId": "cmsv774ls01c7g4p2agkocpck", "title": "Submission KOCPCK", "payload": {"code": "def parse_int(value):\n try:\n return int(value)\n except ValueError as e:\n raise RuntimeError(\"parse failed\") from e\n\ndef safe_parse(value):\n try:\n return parse_int(value)\n except RuntimeError as e:\n return (str(e), type(e.__cause__).__name__, str(e.__cause__))", "input": "safe_parse('abc')", "language": "Python", "predicted_output": "('parse failed', 'ValueError', \"invalid literal for int() with base 10: 'abc'\")"}}
{"submissionId": "cmsv77jdw01chg4p2ycxbv00v", "title": "Submission XBV00V", "payload": {"code": "def wrap_with(tag):\n def decorator(func):\n def wrapper(*args, **kwargs):\n return f\"{tag}({func(*args, **kwargs)})\"\n return wrapper\n return decorator\n\n@wrap_with(\"A\")\n@wrap_with(\"B\")\n@wrap_with(\"C\")\ndef base(x):\n return str(x)", "input": "base(5)", "language": "Python", "predicted_output": "A(B(C(5)))"}}
{"submissionId": "cmsv77xdl01crg4p2jo8bqnsr", "title": "Submission 8BQNSR", "payload": {"code": "def divide_track(a, b):\n log = []\n try:\n result = a / b\n except ZeroDivisionError:\n log.append(\"zero-div\")\n result = None\n except TypeError:\n log.append(\"type-err\")\n result = None\n else:\n log.append(\"ok\")\n finally:\n log.append(\"done\")\n return (result, log)", "input": "(divide_track(10, 2), divide_track(10, 0), divide_track(10, 'x'))", "language": "Python", "predicted_output": "((5.0, ['ok', 'done']), (None, ['zero-div', 'done']), (None, ['type-err', 'done']))"}}
{"submissionId": "cmsv78cao01d1g4p29baw9vgz", "title": "Submission AW9VGZ", "payload": {"code": "import functools\n\ndef running_max_with_index(values):\n return functools.reduce(\n lambda acc, x: acc + [(x[0], max(x[1], acc[-1][1]))] if acc else [x],\n enumerate(values),\n []\n )", "input": "running_max_with_index([3, 1, 4, 1, 5, 9, 2])", "language": "Python", "predicted_output": "[(0, 3), (1, 3), (2, 4), (3, 4), (4, 5), (5, 9), (6, 9)]"}}
{"submissionId": "cmsv78qhr01dcg4p25gkyt9ix", "title": "Submission KYT9IX", "payload": {"code": "def collect_path(n, path=None, seen=[]):\n if path is None:\n path = []\n path.append(n)\n seen.append(n)\n if n <= 1:\n return path, list(seen)\n return collect_path(n // 2, path, seen)", "input": "(collect_path(13)[0], collect_path(6)[1])", "language": "Python", "predicted_output": "([13, 6, 3, 1], [13, 6, 3, 1, 6, 3, 1])"}}
{"submissionId": "cmsv7969101dlg4p2dgeyp5jd", "title": "Submission EYP5JD", "payload": {"code": "def legacy_format(name, score, ratio):\n return \"%-8s|%05d|%6.3f%%\" % (name, score, ratio * 100)", "input": "legacy_format('ax', 42, 0.12345)", "language": "Python", "predicted_output": "ax |00042|12.345%"}}
{"submissionId": "cmsv79mo401dxg4p2x2hqpolm", "title": "Submission HQPOLM", "payload": {"code": "import itertools\n\ndef merge_rows(a, b, c):\n return list(itertools.zip_longest(a, b, c, fillvalue=0))", "input": "merge_rows([1, 2, 3], [10, 20], [100])", "language": "Python", "predicted_output": "[(1, 10, 100), (2, 20, 0), (3, 0, 0)]"}}
{"submissionId": "cmsv7a1ub01e7g4p2zjsuzc0a", "title": "Submission SUZC0A", "payload": {"code": "class ValidationError(Exception):\n pass\n\nclass RangeError(ValidationError):\n pass\n\ndef validate(n):\n trace = []\n try:\n if n < 0:\n raise RangeError(f\"negative:{n}\")\n if n > 100:\n raise ValidationError(f\"too-big:{n}\")\n trace.append(\"passed\")\n except RangeError as e:\n trace.append(f\"range:{e}\")\n except ValidationError as e:\n trace.append(f\"generic:{e}\")\n return trace\n\ndef run_validations():\n return [validate(-5), validate(150), validate(50)]", "input": "run_validations()", "language": "Python", "predicted_output": "[['range:negative:-5'], ['generic:too-big:150'], ['passed']]"}}
{"submissionId": "cmsv84zxr01g4g4p2o5yk1wsb", "title": "Submission YK1WSB", "payload": {"code": "def echo_transform():\n total = 0\n while True:\n received = yield total\n if received is None:\n continue\n total += received\n\ndef run_generator_send():\n gen = echo_transform()\n outputs = [next(gen)]\n outputs.append(gen.send(5))\n outputs.append(gen.send(10))\n outputs.append(gen.send(-3))\n return outputs", "input": "run_generator_send()", "language": "Python", "predicted_output": "[0, 5, 15, 12]"}}
{"submissionId": "cmsv85g3m01g5g4p2n642gsxu", "title": "Submission 42GSXU", "payload": {"code": "def resilient_counter():\n count = 0\n while True:\n try:\n yield count\n count += 1\n except ValueError:\n count = -1\n yield count\n\ndef run_generator_throw():\n gen = resilient_counter()\n out = [next(gen), next(gen)]\n out.append(gen.throw(ValueError(\"reset\")))\n out.append(next(gen))\n return out", "input": "run_generator_throw()", "language": "Python", "predicted_output": "[0, 1, -1, -1]"}}
{"submissionId": "cmsv85wqy01g6g4p2ms1ifp3a", "title": "Submission 1IFP3A", "payload": {"code": "class SuppressType:\n def __init__(self, *types):\n self.types = types\n def __enter__(self):\n return self\n def __exit__(self, exc_type, exc_val, exc_tb):\n return exc_type is not None and issubclass(exc_type, self.types)\n\ndef run_suppress_cm():\n log = []\n with SuppressType(KeyError):\n log.append(\"start\")\n raise KeyError(\"missing\")\n log.append(\"unreachable\")\n log.append(\"after\")\n try:\n with SuppressType(KeyError):\n raise TypeError(\"not suppressed\")\n except TypeError as e:\n log.append(f\"caught:{e}\")\n return log", "input": "run_suppress_cm()", "language": "Python", "predicted_output": "['start', 'after', 'caught:not suppressed']"}}
{"submissionId": "cmsv86dza01g7g4p21qeurz8j", "title": "Submission EURZ8J", "payload": {"code": "import contextlib\n\ndef run_contextlib_suppress():\n log = []\n with contextlib.suppress(ZeroDivisionError, KeyError):\n result = 1 / 0\n log.append(result)\n log.append(\"continued\")\n d = {\"a\": 1}\n with contextlib.suppress(KeyError):\n value = d[\"missing\"]\n log.append(value)\n log.append(\"done\")\n try:\n with contextlib.suppress(ZeroDivisionError):\n raise TypeError(\"not suppressed here\")\n except TypeError as e:\n log.append(f\"caught:{e}\")\n return log", "input": "run_contextlib_suppress()", "language": "Python", "predicted_output": "['continued', 'done', 'caught:not suppressed here']"}}
{"submissionId": "cmsv86t2p01g9g4p2lo85fhgh", "title": "Submission 85FHGH", "payload": {"code": "class UpperAttrMeta(type):\n def __new__(mcs, name, bases, namespace):\n upper_namespace = {}\n for key, value in namespace.items():\n if not key.startswith(\"__\"):\n upper_namespace[key.upper()] = value\n else:\n upper_namespace[key] = value\n return super().__new__(mcs, name, bases, upper_namespace)\n\nclass Config(metaclass=UpperAttrMeta):\n debug = False\n version = \"1.0\"\n\ndef run_metaclass():\n c = Config()\n return sorted(k for k in vars(Config) if not k.startswith(\"__\"))", "input": "run_metaclass()", "language": "Python", "predicted_output": "['DEBUG', 'VERSION']"}}
{"submissionId": "cmsv879kc01gbg4p2hpxv1vg9", "title": "Submission XV1VG9", "payload": {"code": "class PositiveNumber:\n def __set_name__(self, owner, name):\n self.name = \"_\" + name\n def __get__(self, obj, objtype=None):\n if obj is None:\n return self\n return getattr(obj, self.name, None)\n def __set__(self, obj, value):\n if value <= 0:\n raise ValueError(f\"{self.name} must be positive, got {value}\")\n setattr(obj, self.name, value)\n\nclass Account:\n balance = PositiveNumber()\n def __init__(self, balance):\n self.balance = balance\n\ndef run_descriptor():\n a = Account(100)\n results = [a.balance]\n try:\n a.balance = -5\n except ValueError as e:\n results.append(str(e))\n a.balance = 50\n results.append(a.balance)\n return results", "input": "run_descriptor()", "language": "Python", "predicted_output": "[100, '_balance must be positive, got -5', 50]"}}
{"submissionId": "cmsv87q3501gdg4p2r6q7x0i8", "title": "Submission Q7X0I8", "payload": {"code": "class Vector:\n def __init__(self, x, y):\n self.x, self.y = x, y\n def __add__(self, other):\n if isinstance(other, Vector):\n return Vector(self.x + other.x, self.y + other.y)\n return Vector(self.x + other, self.y + other)\n def __radd__(self, other):\n return self.__add__(other)\n def __iadd__(self, other):\n self.x += other.x\n self.y += other.y\n return self\n def __repr__(self):\n return f\"Vector({self.x}, {self.y})\"\n\ndef run_vector_ops():\n v1 = Vector(1, 2)\n v2 = Vector(3, 4)\n v3 = v1 + v2\n v4 = 10 + v1\n v1 += v2\n return [repr(v3), repr(v4), repr(v1)]", "input": "run_vector_ops()", "language": "Python", "predicted_output": "['Vector(4, 6)', 'Vector(11, 12)', 'Vector(4, 6)']"}}
{"submissionId": "cmsv886ak01gfg4p21ndu8jw8", "title": "Submission DU8JW8", "payload": {"code": "from functools import total_ordering\n\n@total_ordering\nclass Card:\n RANKS = [\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"J\",\"Q\",\"K\",\"A\"]\n def __init__(self, rank):\n self.rank = rank\n def __eq__(self, other):\n return self.RANKS.index(self.rank) == self.RANKS.index(other.rank)\n def __lt__(self, other):\n return self.RANKS.index(self.rank) < self.RANKS.index(other.rank)\n def __repr__(self):\n return self.rank\n\ndef run_card_sort():\n cards = [Card(\"K\"), Card(\"2\"), Card(\"A\"), Card(\"10\")]\n return [repr(c) for c in sorted(cards)] + [Card(\"K\") > Card(\"2\"), Card(\"A\") <= Card(\"A\")]", "input": "run_card_sort()", "language": "Python", "predicted_output": "['2', '10', 'K', 'A', True, True]"}}
{"submissionId": "cmsv88pxz01gig4p2eyyyntp5", "title": "Submission YYNTP5", "payload": {"code": "def slice_demo(seq):\n return {\n \"reverse\": seq[::-1],\n \"every_second\": seq[::2],\n \"last_three\": seq[-3:],\n \"middle_step_neg\": seq[-2:-8:-2],\n \"empty\": seq[5:2],\n }", "input": "slice_demo([0,1,2,3,4,5,6,7,8,9])", "language": "Python", "predicted_output": "{'reverse': [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 'every_second': [0, 2, 4, 6, 8], 'last_three': [7, 8, 9], 'middle_step_neg': [8, 6, 4], 'empty': []}"}}
{"submissionId": "cmsv897s901glg4p2x0twxv2j", "title": "Submission TWXV2J", "payload": {"code": "def encoding_demo(s):\n utf8_bytes = s.encode(\"utf-8\")\n ascii_replaced = s.encode(\"ascii\", errors=\"replace\")\n ascii_ignored = s.encode(\"ascii\", errors=\"ignore\")\n back = utf8_bytes.decode(\"utf-8\")\n return (utf8_bytes, ascii_replaced, ascii_ignored, back == s)", "input": "encoding_demo(\"caf\u00e9 na\u00efve\")", "language": "Python", "predicted_output": "(b'caf\\xc3\\xa9 na\\xc3\\xafve', b'caf? na?ve', b'caf nave', True)"}}
{"submissionId": "cmsv89qwp01gog4p2qqsdqoy8", "title": "Submission SDQOY8", "payload": {"code": "def stability_demo():\n data = [(\"a\", 2), (\"b\", 1), (\"c\", 2), (\"d\", 1), (\"e\", 2)]\n return sorted(data, key=lambda pair: pair[1])", "input": "stability_demo()", "language": "Python", "predicted_output": "[('b', 1), ('d', 1), ('a', 2), ('c', 2), ('e', 2)]"}}
{"submissionId": "cmsv8a4u001grg4p2guqb2xil", "title": "Submission QB2XIL", "payload": {"code": "def read_chunks(data, size):\n pos = 0\n chunks = []\n while (chunk := data[pos:pos+size]):\n chunks.append(chunk)\n pos += size\n return chunks", "input": "read_chunks(\"abcdefghij\", 3)", "language": "Python", "predicted_output": "['abc', 'def', 'ghi', 'j']"}}
{"submissionId": "cmsv8al6j01gtg4p2d0xgo649", "title": "Submission XGO649", "payload": {"code": "def walrus_filter(nums):\n return [y for x in nums if (y := x * x) > 10]", "input": "walrus_filter([1,2,3,4,5,6])", "language": "Python", "predicted_output": "[16, 25, 36]"}}
{"submissionId": "cmsv8b4ex01gwg4p2x11r4qpx", "title": "Submission 1R4QPX", "payload": {"code": "def classify(point):\n match point:\n case (0, 0):\n return \"origin\"\n case (x, y) if x == y:\n return \"diagonal\"\n case (x, 0):\n return f\"on x-axis at {x}\"\n case (0, y):\n return f\"on y-axis at {y}\"\n case (x, y) if x > 0 and y > 0:\n return \"quadrant 1\"\n case _:\n return \"other\"\n\ndef run_classify():\n return [classify(p) for p in [(0,0),(3,3),(5,0),(0,-2),(2,4),(-1,-1)]]", "input": "run_classify()", "language": "Python", "predicted_output": "['origin', 'diagonal', 'on x-axis at 5', 'on y-axis at -2', 'quadrant 1', 'diagonal']"}}
{"submissionId": "cmsv8bpkj01h0g4p2wvdtqvpf", "title": "Submission DTQVPF", "payload": {"code": "from dataclasses import dataclass\n\n@dataclass\nclass Point:\n x: int\n y: int\n\ndef describe(shape):\n match shape:\n case Point(x=0, y=0):\n return \"origin point\"\n case Point(x=x, y=y) if x == y:\n return f\"diagonal point at {x}\"\n case Point(x=x, y=y):\n return f\"point at ({x}, {y})\"\n case [Point(0, 0), Point(0, 0)]:\n return \"two origins\"\n case _:\n return \"unknown\"\n\ndef run_describe():\n return [describe(Point(0,0)), describe(Point(5,5)), describe(Point(1,2)), describe(\"nope\")]", "input": "run_describe()", "language": "Python", "predicted_output": "['origin point', 'diagonal point at 5', 'point at (1, 2)', 'unknown']"}}
{"submissionId": "cmsv8cew301h4g4p2ao3kya2u", "title": "Submission 3KYA2U", "payload": {"code": "def coercion_demo():\n a = 0.1 + 0.2\n b = True + True + True\n c = 3 / 2\n d = 3 // 2\n e = -3 // 2\n f = -3 % 2\n g = int(2.9999999999999996)\n h = bool(0.0) or bool(-0.0)\n return (a, a == 0.3, b, type(b).__name__, c, d, e, f, g, h)", "input": "coercion_demo()", "language": "Python", "predicted_output": "(0.30000000000000004, False, 3, 'int', 1.5, 1, -2, 1, 2, False)"}}
{"submissionId": "cmsv8dsej01h8g4p2drb8n7pn", "title": "Submission B8N7PN", "payload": {"code": "def set_demo():\n a = {1, 2, 3, 4}\n b = {3, 4, 5, 6}\n sym = a ^ b\n fs = frozenset(a)\n cache = {fs: \"cached_result\"}\n lookup = cache.get(frozenset({4,3,2,1}))\n try:\n fs.add(10)\n mutation_error = None\n except AttributeError as e:\n mutation_error = \"AttributeError\"\n return (sorted(sym), lookup, mutation_error, a.issubset(a | b))", "input": "set_demo()", "language": "Python", "predicted_output": "([1, 2, 5, 6], 'cached_result', 'AttributeError', True)"}}
{"submissionId": "cmsv8euwv01hbg4p2mjljkyjv", "title": "Submission LJKYJV", "payload": {"code": "import weakref\n\nclass Node:\n def __init__(self, name):\n self.name = name\n\ndef run_weakref():\n n = Node(\"alpha\")\n ref = weakref.ref(n)\n before = ref() is not None\n log = [before, ref().name]\n del n\n after = ref() is None\n log.append(after)\n return log", "input": "run_weakref()", "language": "Python", "predicted_output": "[True, 'alpha', True]"}}
{"submissionId": "cmsv8fx9i01hgg4p230jy4ct2", "title": "Submission JY4CT2", "payload": {"code": "class Temperature:\n def __init__(self, celsius):\n self._celsius = celsius\n @property\n def celsius(self):\n return self._celsius\n @celsius.setter\n def celsius(self, value):\n if value < -273.15:\n raise ValueError(\"below absolute zero\")\n self._celsius = value\n @property\n def fahrenheit(self):\n return self._celsius * 9/5 + 32\n\ndef run_temperature():\n t = Temperature(25)\n results = [t.fahrenheit]\n t.celsius = 100\n results.append(t.fahrenheit)\n try:\n t.celsius = -300\n except ValueError as e:\n results.append(str(e))\n return results", "input": "run_temperature()", "language": "Python", "predicted_output": "[77.0, 212.0, 'below absolute zero']"}}
{"submissionId": "cmsv8h8yd01hlg4p2nl1wv5rp", "title": "Submission 1WV5RP", "payload": {"code": "class Point2D:\n __slots__ = (\"x\", \"y\")\n def __init__(self, x, y):\n self.x = x\n self.y = y\n\nclass Point3D(Point2D):\n __slots__ = (\"z\",)\n def __init__(self, x, y, z):\n super().__init__(x, y)\n self.z = z\n\ndef run_slots():\n p = Point2D(1, 2)\n results = []\n try:\n p.z = 5\n results.append(\"no error\")\n except AttributeError as e:\n results.append(\"AttributeError\")\n p3 = Point3D(1, 2, 3)\n p3.z = 10\n results.append((p3.x, p3.y, p3.z))\n try:\n p3.w = 1\n results.append(\"no error 2\")\n except AttributeError:\n results.append(\"AttributeError2\")\n return results", "input": "run_slots()", "language": "Python", "predicted_output": "['AttributeError', (1, 2, 10), 'AttributeError2']"}}
{"submissionId": "cmsv9c94m01jmg4p2ezphf5e1", "title": "Submission PHF5E1", "payload": {"code": "import bisect\n\n\ndef insert_both(words, word):\n left = sorted(words, key=len)\n right = list(left)\n bisect.insort_left(left, word, key=len)\n bisect.insort_right(right, word, key=len)\n pos_left = bisect.bisect_left(sorted(words, key=len), len(word), key=len)\n pos_right = bisect.bisect_right(sorted(words, key=len), len(word), key=len)\n return (left, right, pos_left, pos_right)", "input": "insert_both([\"aa\", \"bb\", \"cc\", \"dddd\"], \"xx\")", "language": "Python", "predicted_output": "(['xx', 'aa', 'bb', 'cc', 'dddd'], ['aa', 'bb', 'cc', 'xx', 'dddd'], 0, 3)"}}
{"submissionId": "cmsv9c94m01jng4p2zsoo9wh4", "title": "Submission OO9WH4", "payload": {"code": "import heapq\n\n\ndef schedule(tasks):\n heap = []\n for name, pri in tasks:\n heapq.heappush(heap, (pri, name))\n snapshot = list(heap)\n first = heapq.heappop(heap)\n pushed = heapq.heappushpop(heap, (5, \"late\"))\n replaced = heapq.heapreplace(heap, (0, \"now\"))\n return (snapshot, first, pushed, replaced, heap[0], sorted(heap))", "input": "schedule([(\"b\", 2), (\"a\", 2), (\"c\", 1), (\"d\", 3)])", "language": "Python", "predicted_output": "([(1, 'c'), (2, 'b'), (2, 'a'), (3, 'd')], (1, 'c'), (2, 'a'), (2, 'b'), (0, 'now'), [(0, 'now'), (3, 'd'), (5, 'late')])"}}
{"submissionId": "cmsv9c94m01jog4p2c4u1rhyp", "title": "Submission U1RHYP", "payload": {"code": "from collections import deque\n\n\ndef window(values, size):\n dq = deque(maxlen=size)\n trail = []\n for v in values:\n dq.append(v)\n trail.append(list(dq))\n dq.appendleft(\"L\")\n after_left = list(dq)\n dq.rotate(2)\n after_rot = list(dq)\n dq.extendleft([7, 8, 9])\n return (trail, after_left, after_rot, list(dq), dq.maxlen)", "input": "window([1, 2, 3, 4], 3)", "language": "Python", "predicted_output": "([[1], [1, 2], [1, 2, 3], [2, 3, 4]], ['L', 2, 3], [2, 3, 'L'], [9, 8, 7], 3)"}}
{"submissionId": "cmsv9c94m01jpg4p2g2qfcpo2", "title": "Submission QFCPO2", "payload": {"code": "from collections import OrderedDict\n\n\ndef reorder(pairs):\n od = OrderedDict(pairs)\n plain = dict(pairs)\n od.move_to_end(\"a\")\n od.move_to_end(\"c\", last=False)\n mirror = OrderedDict(reversed(list(od.items())))\n same_order = od == mirror\n as_plain = dict(od) == dict(mirror)\n vs_dict = plain == dict(od)\n popped = od.popitem(last=False)\n return (list(od), list(mirror), same_order, as_plain, vs_dict, popped, list(plain))", "input": "reorder([(\"a\", 1), (\"b\", 2), (\"c\", 3)])", "language": "Python", "predicted_output": "(['b', 'a'], ['a', 'b', 'c'], False, True, True, ('c', 3), ['a', 'b', 'c'])"}}
{"submissionId": "cmsv9c94m01jqg4p2wk8m5xh5", "title": "Submission 8M5XH5", "payload": {"code": "def carve(text, sep):\n return (\n text.partition(sep),\n text.rpartition(sep),\n text.split(sep, 1),\n text.rsplit(sep, 1),\n \"nope\".partition(sep),\n \"nope\".rpartition(sep),\n len(text.partition(sep)),\n len(\"nope\".split(sep)),\n )", "input": "carve(\"a=b=c\", \"=\")", "language": "Python", "predicted_output": "(('a', '=', 'b=c'), ('a=b', '=', 'c'), ['a', 'b=c'], ['a=b', 'c'], ('nope', '', ''), ('', '', 'nope'), 3, 1)"}}
{"submissionId": "cmsv9c94m01jrg4p209o5iu2r", "title": "Submission O5IU2R", "payload": {"code": "def mutate(raw):\n ba = bytearray(raw)\n ba[0] = ba[0] + 1\n ba[1:3] = b\"XYZ\"\n return (\n raw[0],\n raw[:1],\n list(raw),\n bytes(ba),\n len(ba),\n raw,\n raw + b\"!\",\n bytes(bytearray(3)),\n )", "input": "mutate(b\"abc\")", "language": "Python", "predicted_output": "(97, b'a', [97, 98, 99], b'bXYZ', 4, b'abc', b'abc!', b'\\x00\\x00\\x00')"}}
{"submissionId": "cmsv9c94m01jsg4p2896ucicd", "title": "Submission 6UCICD", "payload": {"code": "def floaty():\n a = 0.1 + 0.2\n return (\n a,\n a == 0.3,\n repr(a) == \"0.30000000000000004\",\n float(repr(a)) == a,\n round(a, 2),\n round(2.675, 2),\n (round(0.5), round(1.5), round(2.5), round(-0.5)),\n 1e16 + 1 == 1e16,\n 0.1 + 0.2 + 0.3 == 0.1 + (0.2 + 0.3),\n )", "input": "floaty()", "language": "Python", "predicted_output": "(0.30000000000000004, False, True, True, 0.3, 2.67, (0, 2, 2, 0), True, False)"}}
{"submissionId": "cmsv9c94m01jtg4p2bbitbyxl", "title": "Submission ITBYXL", "payload": {"code": "from decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP\nfrom fractions import Fraction\n\n\ndef money():\n exact = Decimal(\"0.1\") * 3\n return (\n str(exact),\n exact == Decimal(\"0.3\"),\n Decimal(0.1) == Decimal(\"0.1\"),\n str(Decimal(\"2.665\").quantize(Decimal(\"0.01\"), rounding=ROUND_HALF_UP)),\n str(Decimal(\"2.665\").quantize(Decimal(\"0.01\"), rounding=ROUND_HALF_EVEN)),\n round(2.675, 2),\n str(Decimal(\"1.10\") + Decimal(\"2.20\")),\n Decimal(\"1.10\") == Decimal(\"1.1\"),\n Fraction(Decimal(\"0.25\")) == Fraction(1, 4),\n Fraction(0.1).limit_denominator(100),\n )", "input": "money()", "language": "Python", "predicted_output": "('0.3', True, False, '2.67', '2.66', 2.67, '3.30', True, True, Fraction(1, 10))"}}
{"submissionId": "cmsv9c94m01jug4p2s1k1wnp0", "title": "Submission K1WNP0", "payload": {"code": "def bits(n):\n return (\n n >> 1,\n n >> 100,\n ~n,\n n.bit_length(),\n (-1) >> 10,\n n & 0xFF,\n format(n & 0xFF, \"08b\"),\n n.to_bytes(2, \"big\", signed=True),\n int.from_bytes(b\"\\xff\\xfe\", \"big\", signed=True),\n int.from_bytes(b\"\\xff\\xfe\", \"big\"),\n )", "input": "bits(-5)", "language": "Python", "predicted_output": "(-3, -1, 4, 3, -1, 251, '11111011', b'\\xff\\xfb', -2, 65534)"}}
{"submissionId": "cmsv9c94n01jvg4p24j3xeyhb", "title": "Submission 3XEYHB", "payload": {"code": "class Grid:\n def __init__(self, data):\n self.data = data\n\n def __getitem__(self, key):\n if isinstance(key, tuple):\n return (\"tuple\", tuple(self._show(k) for k in key))\n return (\"single\", self._show(key))\n\n def _show(self, k):\n if isinstance(k, slice):\n parts = (k.start, k.stop, k.step)\n if all(p is None or isinstance(p, int) for p in parts):\n return parts + (k.indices(len(self.data)),)\n return parts + (\"unindexable\",)\n return k\n\n\ndef probe(grid):\n return (\n grid[1],\n grid[1:3],\n grid[1:3, ::-1],\n grid[..., 2],\n grid[1:9:2],\n grid[\"a\":\"b\"],\n )", "input": "probe(Grid([0, 1, 2, 3, 4]))", "language": "Python", "predicted_output": "(('single', 1), ('single', (1, 3, None, (1, 3, 1))), ('tuple', ((1, 3, None, (1, 3, 1)), (None, None, -1, (4, -1, -1)))), ('tuple', (Ellipsis, 2)), ('single', (1, 9, 2, (1, 5, 2))), ('single', ('a', 'b', None, 'unindexable')))"}}
{"submissionId": "cmsv9c94n01jwg4p2afmlfur4", "title": "Submission MLFUR4", "payload": {"code": "class Point:\n def __init__(self, x):\n self.x = x\n\n def __eq__(self, other):\n if not isinstance(other, Point):\n return NotImplemented\n return self.x == other.x\n\n\nclass Tagged(Point):\n __hash__ = object.__hash__\n\n\ndef check():\n out = []\n p = Point(1)\n t = Tagged(1)\n out.append(Point.__hash__)\n try:\n hash(p)\n except TypeError as exc:\n out.append(type(exc).__name__)\n out.append(Tagged.__hash__ is object.__hash__)\n out.append(hash(t) == hash(Tagged(1)))\n out.append(p == Point(1))\n out.append(p != Point(2))\n out.append(p == 1)\n try:\n {p: 1}\n except TypeError as exc:\n out.append(str(exc))\n return tuple(out)", "input": "check()", "language": "Python", "predicted_output": "(None, 'TypeError', True, False, True, True, False, \"unhashable type: 'Point'\")"}}
{"submissionId": "cmsv9c94n01jxg4p2rioqq5o7", "title": "Submission OQQ5O7", "payload": {"code": "def sets():\n table = {frozenset([1, 2]): \"pair\", frozenset(): \"empty\"}\n s = {1, 2, 3}\n f = frozenset([3, 4])\n return (\n table[frozenset([2, 1])],\n table[frozenset()],\n frozenset([1, 2]) == {1, 2},\n s | f,\n type(s | f).__name__,\n type(f | s).__name__,\n f - s,\n s ^ f,\n len({frozenset([1, 2]), frozenset([2, 1])}),\n frozenset([1, 2]) <= s,\n )", "input": "sets()", "language": "Python", "predicted_output": "('pair', 'empty', True, {1, 2, 3, 4}, 'set', 'frozenset', frozenset({4}), {1, 2, 4}, 1, True)"}}
{"submissionId": "cmsv9c94n01jyg4p2ax0z6e3q", "title": "Submission 0Z6E3Q", "payload": {"code": "import enum\n\n\nclass Status(enum.Enum):\n OK = 1\n FINE = 1\n BAD = 2\n\n @classmethod\n def _missing_(cls, value):\n if value == \"ok\":\n return cls.OK\n return None\n\n\ndef probe():\n out = [m.name for m in Status]\n out.append(Status.FINE is Status.OK)\n out.append(Status.FINE.name)\n out.append(Status(\"ok\").name)\n out.append(sorted(Status.__members__))\n out.append(Status(2).name)\n out.append(len(Status))\n try:\n Status(\"nope\")\n except ValueError as exc:\n out.append(type(exc).__name__)\n return tuple(out)", "input": "probe()", "language": "Python", "predicted_output": "('OK', 'BAD', True, 'OK', 'OK', ['BAD', 'FINE', 'OK'], 'BAD', 2, 'ValueError')"}}
{"submissionId": "cmsv9c94n01jzg4p2s9n2695w", "title": "Submission N2695W", "payload": {"code": "import functools\n\n\n@functools.total_ordering\nclass Ver:\n def __init__(self, n):\n self.n = n\n\n def __eq__(self, other):\n if not isinstance(other, Ver):\n return NotImplemented\n return self.n == other.n\n\n def __lt__(self, other):\n if not isinstance(other, Ver):\n return NotImplemented\n return self.n < other.n\n\n\ndef probe():\n a, b = Ver(1), Ver(2)\n return (\n a < b,\n a <= b,\n a >= b,\n b > a,\n a != b,\n sorted(k for k in Ver.__dict__ if k in (\"__lt__\", \"__le__\", \"__gt__\", \"__ge__\")),\n a.__gt__(5),\n a.__eq__(5),\n Ver(1) <= Ver(1),\n [v.n for v in sorted([Ver(3), Ver(1), Ver(2)], reverse=True)],\n )", "input": "probe()", "language": "Python", "predicted_output": "(True, True, False, True, True, ['__ge__', '__gt__', '__le__', '__lt__'], NotImplemented, NotImplemented, True, [3, 2, 1])"}}
{"submissionId": "cmsv9c94n01k0g4p22tupv5jw", "title": "Submission UPV5JW", "payload": {"code": "def describe(a, b, /, c, *, d=4, **rest):\n return (a, b, c, d, rest)\n\n\ndef probe():\n out = []\n out.append(describe(1, 2, 3))\n out.append(describe(1, 2, c=3, d=9, a=99, b=100))\n try:\n describe(1, 2, 3, 4)\n except TypeError as exc:\n out.append(type(exc).__name__)\n try:\n describe(a=1, b=2, c=3)\n except TypeError as exc:\n out.append(type(exc).__name__)\n out.append(describe(*[1, 2], **{\"c\": 3, \"d\": 0}))\n return tuple(out)", "input": "probe()", "language": "Python", "predicted_output": "((1, 2, 3, 4, {}), (1, 2, 3, 9, {'a': 99, 'b': 100}), 'TypeError', 'TypeError', (1, 2, 3, 0, {}))"}}
{"submissionId": "cmsv9c94n01k1g4p2g1l7ctg6", "title": "Submission L7CTG6", "payload": {"code": "from dataclasses import dataclass, field, asdict, replace\n\n\n@dataclass\nclass Cart:\n owner: str\n items: list = field(default_factory=list)\n tag: str = field(default=\"x\", repr=False)\n\n def add(self, thing):\n self.items.append(thing)\n return self\n\n\ndef probe():\n a = Cart(\"ann\")\n b = Cart(\"bob\")\n a.add(\"apple\")\n c = replace(a, owner=\"cat\")\n c.items.append(\"pear\")\n snap = asdict(a)\n a.add(\"plum\")\n return (a.items, b.items, c.items, a.items is c.items, a.items is b.items, repr(b), snap)", "input": "probe()", "language": "Python", "predicted_output": "(['apple', 'pear', 'plum'], [], ['apple', 'pear', 'plum'], True, False, \"Cart(owner='bob', items=[])\", {'owner': 'ann', 'items': ['apple', 'pear'], 'tag': 'x'})"}}
{"submissionId": "cmsv9c94n01k2g4p2wpxhj7t2", "title": "Submission XHJ7T2", "payload": {"code": "def trace(mode):\n log = []\n\n def run():\n try:\n log.append(\"try\")\n if mode == \"raise\":\n raise ValueError(\"x\")\n if mode == \"return\":\n return \"from-try\"\n except ValueError:\n log.append(\"except\")\n return \"from-except\"\n else:\n log.append(\"else\")\n return \"from-else\"\n finally:\n log.append(\"finally\")\n\n return (run(), log)\n\n\ndef all_modes():\n return [trace(m) for m in (\"raise\", \"return\", \"plain\")]", "input": "all_modes()", "language": "Python", "predicted_output": "[('from-except', ['try', 'except', 'finally']), ('from-try', ['try', 'finally']), ('from-else', ['try', 'else', 'finally'])]"}}
{"submissionId": "cmsv9c94n01k3g4p24r66tu8f", "title": "Submission 66TU8F", "payload": {"code": "def find_first(items, target):\n log = []\n for i, x in enumerate(items):\n log.append(x)\n if x == target:\n break\n else:\n log.append(\"no-break\")\n return (-1, log)\n return (i, log)\n\n\ndef probe():\n return (\n find_first([3, 5, 7], 5),\n find_first([3, 5, 7], 9),\n find_first([], 9),\n find_first([3, 5, 7], 3),\n )", "input": "probe()", "language": "Python", "predicted_output": "((1, [3, 5]), (-1, [3, 5, 7, 'no-break']), (-1, ['no-break']), (0, [3]))"}}
{"submissionId": "cmsv9c94n01k4g4p24ol79632", "title": "Submission L79632", "payload": {"code": "import contextlib\n\n\ndef probe():\n log = []\n with contextlib.suppress(KeyError, IndexError):\n log.append(\"start\")\n data = {}\n log.append(data[\"missing\"])\n log.append(\"unreachable\")\n log.append(\"after\")\n try:\n with contextlib.suppress(KeyError):\n raise ValueError(\"boom\")\n except ValueError as exc:\n log.append((\"escaped\", str(exc)))\n with contextlib.suppress(Exception):\n log.append([1][5])\n with contextlib.suppress(KeyError):\n log.append(\"clean\")\n return tuple(log)", "input": "probe()", "language": "Python", "predicted_output": "('start', 'after', ('escaped', 'boom'), 'clean')"}}
{"submissionId": "cmsv9c94n01k5g4p213kufy4d", "title": "Submission KUFY4D", "payload": {"code": "def make_source(values):\n it = iter(values)\n\n def pull():\n return next(it, None)\n\n return pull\n\n\ndef probe():\n src = make_source([1, 2, 0, 3, 4])\n got = list(iter(src, 0))\n rest = [src(), src(), src()]\n counter = {\"n\": 0}\n\n def tick():\n counter[\"n\"] += 1\n return counter[\"n\"]\n\n stopped = list(iter(tick, 4))\n never = iter(tick, \"never\")\n return (got, rest, stopped, counter[\"n\"], next(never), callable(src))", "input": "probe()", "language": "Python", "predicted_output": "([1, 2], [3, 4, None], [1, 2, 3], 4, 5, True)"}}
{"submissionId": "cmsvchb1101nsg4p2zvklbmo3", "title": "Submission KLBMO3", "payload": {"code": "def counter():\n log = []\n def gen():\n for i in range(5):\n log.append(i)\n yield i * i\n squares = gen()\n first_two = [next(squares), next(squares)]\n return first_two, log", "input": "counter()", "language": "Python", "predicted_output": "([0, 1], [0, 1])"}}
{"submissionId": "cmsvchb1101ntg4p272q2apwm", "title": "Submission Q2APWM", "payload": {"code": "def probe(store):\n a = store.get('x', 0)\n b = store.setdefault('y', 0)\n c = store.setdefault('y', 99)\n return a, b, c, sorted(store)", "input": "probe({'z': 1})", "language": "Python", "predicted_output": "(0, 0, 0, ['y', 'z'])"}}
{"submissionId": "cmsvchb1101nug4p285cv2zf1", "title": "Submission CV2ZF1", "payload": {"code": "def reshape(values):\n out = list(values)\n out[1:3] = ['a']\n out[0:0] = ['start']\n return out, len(out)", "input": "reshape([10, 20, 30, 40])", "language": "Python", "predicted_output": "(['start', 10, 'a', 40], 4)"}}
{"submissionId": "cmsvchb1101nvg4p2u5ltajpz", "title": "Submission LTAJPZ", "payload": {"code": "def classify(value):\n try:\n return 10 / value\n except ZeroDivisionError:\n return 'zero'\n except TypeError:\n return 'type'\n\ndef run():\n return [classify(v) for v in (5, 0, 'x')]", "input": "run()", "language": "Python", "predicted_output": "[2.0, 'zero', 'type']"}}
{"submissionId": "cmsvchb1101nwg4p22s57bx7k", "title": "Submission 57BX7K", "payload": {"code": "def leaderboard(rows):\n return sorted(rows, key=lambda r: (r['pts'], -len(r['name'])), reverse=True)", "input": "leaderboard([{'name': 'ann', 'pts': 3}, {'name': 'bo', 'pts': 3}, {'name': 'cyd', 'pts': 5}])", "language": "Python", "predicted_output": "[{'name': 'cyd', 'pts': 5}, {'name': 'bo', 'pts': 3}, {'name': 'ann', 'pts': 3}]"}}
{"submissionId": "cmsvg8rg101ocg4p2k6vrje5s", "title": "Submission VRJE5S", "payload": {"code": "def bucket_scores(scores):\n buckets = {\"low\": [], \"mid\": [], \"high\": []}\n for s in scores:\n if not isinstance(s, (int, float)):\n continue\n if s < 50:\n buckets[\"low\"].append(s)\n elif s < 80:\n buckets[\"mid\"].append(s)\n else:\n buckets[\"high\"].append(s)\n return {k: sorted(v) for k, v in buckets.items() if v}", "input": "bucket_scores([45, 91, \"skip\", 62, 79, 100, 12])", "language": "Python", "predicted_output": "{'low': [12, 45], 'mid': [62, 79], 'high': [91, 100]}"}}
{"submissionId": "cmsvg8rg101odg4p2tggwl9ih", "title": "Submission GWL9IH", "payload": {"code": "class Inventory:\n def __init__(self):\n self.stock = {}\n def add(self, name, qty):\n self.stock[name] = self.stock.get(name, 0) + qty\n def remove(self, name, qty):\n if name not in self.stock or self.stock[name] < qty:\n raise ValueError(f\"insufficient stock for {name}\")\n self.stock[name] -= qty\n if self.stock[name] == 0:\n del self.stock[name]\n def snapshot(self):\n return dict(sorted(self.stock.items()))\n\ndef run_ops():\n inv = Inventory()\n inv.add(\"widget\", 10)\n inv.add(\"gadget\", 5)\n inv.remove(\"widget\", 4)\n try:\n inv.remove(\"gizmo\", 1)\n except ValueError as e:\n errmsg = str(e)\n return (inv.snapshot(), errmsg)", "input": "run_ops()", "language": "Python", "predicted_output": "({'gadget': 5, 'widget': 6}, 'insufficient stock for gizmo')"}}
{"submissionId": "cmsvg8rg101oeg4p2wxkp0g6b", "title": "Submission KP0G6B", "payload": {"code": "def running_median(nums):\n import bisect\n sorted_so_far = []\n medians = []\n for n in nums:\n bisect.insort(sorted_so_far, n)\n length = len(sorted_so_far)\n mid = length // 2\n if length % 2 == 1:\n medians.append(sorted_so_far[mid])\n else:\n medians.append((sorted_so_far[mid - 1] + sorted_so_far[mid]) / 2)\n return medians", "input": "running_median([5, 2, 8, 1, 9, 3])", "language": "Python", "predicted_output": "[5, 3.5, 5, 3.5, 5, 4.0]"}}
{"submissionId": "cmsvg8rg101ofg4p2czsiq8tl", "title": "Submission SIQ8TL", "payload": {"code": "def parse_key_values(pairs):\n result = {}\n for pair in pairs:\n try:\n key, value = pair.split(\"=\", 1)\n except ValueError:\n continue\n key = key.strip()\n value = value.strip()\n if value.isdigit():\n result[key] = int(value)\n else:\n try:\n result[key] = float(value)\n except ValueError:\n result[key] = value\n return result", "input": "parse_key_values([\"a=10\", \"b=3.5\", \"c=hello\", \"broken\", \"d= 7 \"])", "language": "Python", "predicted_output": "{'a': 10, 'b': 3.5, 'c': 'hello', 'd': 7}"}}
{"submissionId": "cmsvg8rg101ogg4p2ywgce6y2", "title": "Submission GCE6Y2", "payload": {"code": "def dedupe_preserve_order(items):\n seen = set()\n result = []\n for item in items:\n key = item.lower() if isinstance(item, str) else item\n if key in seen:\n continue\n seen.add(key)\n result.append(item)\n return result\n\ndef zip_with_index(items, start=1):\n return [(start + i, v) for i, v in enumerate(dedupe_preserve_order(items))]", "input": "zip_with_index([\"Apple\", \"banana\", \"apple\", \"Cherry\", \"BANANA\"], start=100)", "language": "Python", "predicted_output": "[(100, 'Apple'), (101, 'banana'), (102, 'Cherry')]"}}
{"submissionId": "cmsvgvd6401r9g4p2ha3kk07q", "title": "Submission 3KK07Q", "payload": {"code": "def flatten(lst):\n result = []\n for item in lst:\n if isinstance(item, list):\n result.extend(flatten(item))\n else:\n result.append(item)\n return result", "input": "flatten([1, [2, 3, [4, 5]], 6, [7, [8, [9]]]])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7, 8, 9]"}}
{"submissionId": "cmsvgvd6401rag4p26o3rhyqv", "title": "Submission 3RHYQV", "payload": {"code": "def gcd_steps(a, b):\n steps = 0\n while b:\n a, b = b, a % b\n steps += 1\n return (a, steps)", "input": "gcd_steps(252, 105)", "language": "Python", "predicted_output": "(21, 3)"}}
{"submissionId": "cmsvgwu2901rbg4p25vf687de", "title": "Submission F687DE", "payload": {"code": "import itertools\n\ndef take_n_squares(n):\n def gen():\n i = 1\n while True:\n yield i * i\n i += 1\n return list(itertools.islice(gen(), n))", "input": "take_n_squares(6)", "language": "Python", "predicted_output": "[1, 4, 9, 16, 25, 36]"}}
{"submissionId": "cmsvgxdx301rcg4p2bbdyquxq", "title": "Submission DYQUXQ", "payload": {"code": "import re\n\ndef tokenize(text):\n return [t for t in re.split(r\"[,;\\s]+\", text.strip()) if t]", "input": "tokenize(\"apple, banana, cherry ,date\")", "language": "Python", "predicted_output": "['apple', 'banana', 'cherry', 'date']"}}
{"submissionId": "cmsvgyl4f01rdg4p2rw9fgj3y", "title": "Submission 9FGJ3Y", "payload": {"code": "from collections import Counter\n\ndef top_words(text, k):\n words = text.lower().split()\n return Counter(words).most_common(k)", "input": "top_words(\"the cat sat on the mat the cat ran\", 2)", "language": "Python", "predicted_output": "[('the', 3), ('cat', 2)]"}}
{"submissionId": "cmsvgyl4f01reg4p2a49hwugz", "title": "Submission 9HWUGZ", "payload": {"code": "def flatten_dict(d, parent_key=\"\"):\n items = {}\n for k, v in d.items():\n new_key = f\"{parent_key}.{k}\" if parent_key else k\n if isinstance(v, dict):\n items.update(flatten_dict(v, new_key))\n else:\n items[new_key] = v\n return items", "input": "flatten_dict({\"a\": 1, \"b\": {\"c\": 2, \"d\": {\"e\": 3}}})", "language": "Python", "predicted_output": "{'a': 1, 'b.c': 2, 'b.d.e': 3}"}}
{"submissionId": "cmsvgz4ah01rfg4p2ylkbpjg2", "title": "Submission KBPJG2", "payload": {"code": "class ValidationError(Exception):\n pass\n\ndef validate_all(records):\n errors = []\n for i, r in enumerate(records):\n if \"age\" not in r:\n errors.append(f\"record {i}: missing age\")\n elif r[\"age\"] < 0:\n errors.append(f\"record {i}: negative age\")\n if errors:\n raise ValidationError(\"; \".join(errors))\n return \"all valid\"\n\ndef run_validation(records):\n try:\n return validate_all(records)\n except ValidationError as e:\n return str(e)", "input": "run_validation([{\"age\": 5}, {\"name\": \"x\"}, {\"age\": -3}])", "language": "Python", "predicted_output": "record 1: missing age; record 2: negative age"}}
{"submissionId": "cmsvh09gc01rgg4p2crm31q55", "title": "Submission M31Q55", "payload": {"code": "def merge_sorted(a, b):\n result = []\n i = j = 0\n while i < len(a) and j < len(b):\n if a[i] <= b[j]:\n result.append(a[i])\n i += 1\n else:\n result.append(b[j])\n j += 1\n result.extend(a[i:])\n result.extend(b[j:])\n return result", "input": "merge_sorted([1, 4, 6], [2, 3, 9, 10])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 6, 9, 10]"}}
{"submissionId": "cmsvh09gc01rhg4p2hdmhquum", "title": "Submission MHQUUM", "payload": {"code": "def is_balanced(s):\n pairs = {\")\": \"(\", \"]\": \"[\", \"}\": \"{\"}\n stack = []\n for ch in s:\n if ch in \"([{\":\n stack.append(ch)\n elif ch in \")]}\":\n if not stack or stack.pop() != pairs[ch]:\n return False\n return not stack", "input": "is_balanced(\"([a{b}c](d))\")", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsvh09gc01rig4p21uvm3dup", "title": "Submission VM3DUP", "payload": {"code": "def caesar(text, shift):\n result = []\n for ch in text:\n if ch.isalpha():\n base = ord(\"A\") if ch.isupper() else ord(\"a\")\n result.append(chr((ord(ch) - base + shift) % 26 + base))\n else:\n result.append(ch)\n return \"\".join(result)", "input": "caesar(\"Hello, World!\", 5)", "language": "Python", "predicted_output": "Mjqqt, Btwqi!"}}
{"submissionId": "cmsvh1ew801rjg4p25twjdmy0", "title": "Submission WJDMY0", "payload": {"code": "def compute_facts(ns):\n cache = {}\n def fact(n):\n if n in cache:\n return cache[n]\n if n <= 1:\n result = 1\n else:\n result = n * fact(n - 1)\n cache[n] = result\n return result\n return [fact(x) for x in ns]", "input": "compute_facts([0, 1, 2, 3, 4, 5])", "language": "Python", "predicted_output": "[1, 1, 2, 6, 24, 120]"}}
{"submissionId": "cmsvh1ew801rkg4p2ah41bavi", "title": "Submission 41BAVI", "payload": {"code": "def caesar_encrypt(text, shift):\n result = []\n for ch in text:\n if ch.isalpha():\n base = ord('A') if ch.isupper() else ord('a')\n result.append(chr((ord(ch) - base + shift) % 26 + base))\n else:\n result.append(ch)\n return \"\".join(result)", "input": "caesar_encrypt('Hello, World!', 3)", "language": "Python", "predicted_output": "Khoor, Zruog!"}}
{"submissionId": "cmsvh1ew801rlg4p2b5ielaub", "title": "Submission IELAUB", "payload": {"code": "def rotate_left(lst, k):\n if not lst:\n return lst\n k %= len(lst)\n return lst[k:] + lst[:k]", "input": "rotate_left([1, 2, 3, 4, 5], 8)", "language": "Python", "predicted_output": "[4, 5, 1, 2, 3]"}}
{"submissionId": "cmsvh1rgp01rmg4p2tws8r7v8", "title": "Submission S8R7V8", "payload": {"code": "from collections import OrderedDict\n\nclass LRUCache:\n def __init__(self, capacity):\n self.capacity = capacity\n self.data = OrderedDict()\n def get(self, key):\n if key not in self.data:\n return -1\n self.data.move_to_end(key)\n return self.data[key]\n def put(self, key, value):\n if key in self.data:\n self.data.move_to_end(key)\n self.data[key] = value\n if len(self.data) > self.capacity:\n self.data.popitem(last=False)\n\ndef run_cache():\n c = LRUCache(2)\n c.put(\"a\", 1)\n c.put(\"b\", 2)\n c.get(\"a\")\n c.put(\"c\", 3)\n return list(c.data.items())", "input": "run_cache()", "language": "Python", "predicted_output": "[('a', 1), ('c', 3)]"}}
{"submissionId": "cmsvh1rgp01rng4p2korsuouz", "title": "Submission RSUOUZ", "payload": {"code": "def int_to_roman(num):\n vals = [(1000, \"M\"), (900, \"CM\"), (500, \"D\"), (400, \"CD\"), (100, \"C\"),\n (90, \"XC\"), (50, \"L\"), (40, \"XL\"), (10, \"X\"), (9, \"IX\"),\n (5, \"V\"), (4, \"IV\"), (1, \"I\")]\n result = \"\"\n for v, sym in vals:\n while num >= v:\n result += sym\n num -= v\n return result", "input": "int_to_roman(1994)", "language": "Python", "predicted_output": "MCMXCIV"}}
{"submissionId": "cmsvh1rgp01rog4p2u6zuzhn5", "title": "Submission ZUZHN5", "payload": {"code": "def chunk(lst, n):\n return [lst[i:i + n] for i in range(0, len(lst), n)]", "input": "chunk([1, 2, 3, 4, 5, 6, 7], 3)", "language": "Python", "predicted_output": "[[1, 2, 3], [4, 5, 6], [7]]"}}
{"submissionId": "cmsvh1rgp01rpg4p2zs5swh2h", "title": "Submission 5SWH2H", "payload": {"code": "def modes(values):\n from collections import Counter\n counts = Counter(values)\n max_count = max(counts.values())\n return sorted(v for v, c in counts.items() if c == max_count)", "input": "modes([1, 2, 2, 3, 3, 4])", "language": "Python", "predicted_output": "[2, 3]"}}
{"submissionId": "cmsvh1rgp01rqg4p26r0i5nwy", "title": "Submission 0I5NWY", "payload": {"code": "def two_sum(nums, target):\n seen = {}\n for i, n in enumerate(nums):\n complement = target - n\n if complement in seen:\n return [seen[complement], i]\n seen[n] = i\n return None", "input": "two_sum([2, 7, 11, 15, 3], 13)", "language": "Python", "predicted_output": "[0, 2]"}}
{"submissionId": "cmsvh1rgp01rrg4p2v8usgajo", "title": "Submission USGAJO", "payload": {"code": "class Point:\n def __init__(self, x, y):\n self.x = x\n self.y = y\n def __eq__(self, other):\n return isinstance(other, Point) and self.x == other.x and self.y == other.y\n def __hash__(self):\n return hash((self.x, self.y))\n def __repr__(self):\n return f\"Point({self.x}, {self.y})\"\n\ndef dedupe_points(points):\n return sorted(set(points), key=lambda p: (p.x, p.y))", "input": "dedupe_points([Point(1, 2), Point(3, 4), Point(1, 2), Point(0, 0)])", "language": "Python", "predicted_output": "[Point(0, 0), Point(1, 2), Point(3, 4)]"}}
{"submissionId": "cmsvh1rgp01rsg4p28dd4alq4", "title": "Submission D4ALQ4", "payload": {"code": "def pipeline_sum(nums):\n evens = filter(lambda x: x % 2 == 0, nums)\n doubled = map(lambda x: x * 2, evens)\n return sum(doubled)", "input": "pipeline_sum([1, 2, 3, 4, 5, 6, 7, 8])", "language": "Python", "predicted_output": "40"}}
{"submissionId": "cmsvh3vna01rtg4p2dud9lsao", "title": "Submission D9LSAO", "payload": {"code": "def fib_sequence(n):\n a, b = 0, 1\n seq = []\n for _ in range(n):\n seq.append(a)\n a, b = b, a + b\n return seq", "input": "fib_sequence(10)", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]"}}
{"submissionId": "cmsvh3vna01rug4p2rchwkc82", "title": "Submission HWKC82", "payload": {"code": "def primes_up_to(n):\n sieve = [True] * (n + 1)\n sieve[0:2] = [False, False]\n for i in range(2, int(n ** 0.5) + 1):\n if sieve[i]:\n for j in range(i * i, n + 1, i):\n sieve[j] = False\n return [i for i, is_p in enumerate(sieve) if is_p]", "input": "primes_up_to(30)", "language": "Python", "predicted_output": "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]"}}
{"submissionId": "cmsvh3vna01rvg4p2h1hf5l6y", "title": "Submission HF5L6Y", "payload": {"code": "def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef gcd_lcm_pair(a, b):\n g = gcd(a, b)\n return (g, a * b // g)", "input": "gcd_lcm_pair(48, 18)", "language": "Python", "predicted_output": "(6, 144)"}}
{"submissionId": "cmsvh3vna01rwg4p2r776mh9b", "title": "Submission 76MH9B", "payload": {"code": "def word_freq(text):\n words = text.lower().split()\n freq = {}\n for w in words:\n freq[w] = freq.get(w, 0) + 1\n return sorted(freq.items(), key=lambda kv: (-kv[1], kv[0]))", "input": "word_freq(\"the cat sat on the mat the cat ran\")", "language": "Python", "predicted_output": "[('the', 3), ('cat', 2), ('mat', 1), ('on', 1), ('ran', 1), ('sat', 1)]"}}
{"submissionId": "cmsvh3vna01rxg4p26kbl19jw", "title": "Submission BL19JW", "payload": {"code": "def run_length_encode(s):\n if not s:\n return \"\"\n result = []\n prev = s[0]\n count = 1\n for ch in s[1:]:\n if ch == prev:\n count += 1\n else:\n result.append(prev + str(count))\n prev = ch\n count = 1\n result.append(prev + str(count))\n return \"\".join(result)", "input": "run_length_encode(\"aaabbbccd\")", "language": "Python", "predicted_output": "a3b3c2d1"}}
{"submissionId": "cmsvh3vna01ryg4p2hx4bq6mh", "title": "Submission 4BQ6MH", "payload": {"code": "def matmul(a, b):\n rows_a, cols_a = len(a), len(a[0])\n cols_b = len(b[0])\n result = [[0] * cols_b for _ in range(rows_a)]\n for i in range(rows_a):\n for j in range(cols_b):\n total = 0\n for k in range(cols_a):\n total += a[i][k] * b[k][j]\n result[i][j] = total\n return result", "input": "matmul([[1, 2], [3, 4]], [[5, 6], [7, 8]])", "language": "Python", "predicted_output": "[[19, 22], [43, 50]]"}}
{"submissionId": "cmsvh3vna01rzg4p2u26zgec3", "title": "Submission 6ZGEC3", "payload": {"code": "def longest_common_prefix(words):\n if not words:\n return \"\"\n prefix = words[0]\n for w in words[1:]:\n while not w.startswith(prefix):\n prefix = prefix[:-1]\n if not prefix:\n return \"\"\n return prefix", "input": "longest_common_prefix([\"flower\", \"flow\", \"flight\"])", "language": "Python", "predicted_output": "fl"}}
{"submissionId": "cmsvh3vna01s0g4p2rz19dqbh", "title": "Submission 19DQBH", "payload": {"code": "def quicksort(arr):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n left = [x for x in arr if x < pivot]\n mid = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quicksort(left) + mid + quicksort(right)", "input": "quicksort([5, 2, 9, 1, 5, 6])", "language": "Python", "predicted_output": "[1, 2, 5, 5, 6, 9]"}}
{"submissionId": "cmsvh3vna01s1g4p2wsoodnw4", "title": "Submission OODNW4", "payload": {"code": "def max_subarray_sum(nums):\n best = nums[0]\n current = nums[0]\n for n in nums[1:]:\n current = max(n, current + n)\n best = max(best, current)\n return best", "input": "max_subarray_sum([-2, 1, -3, 4, -1, 2, 1, -5, 4])", "language": "Python", "predicted_output": "6"}}
{"submissionId": "cmsvh3vna01s2g4p21vgxpiy2", "title": "Submission GXPIY2", "payload": {"code": "def roman_to_int(s):\n values = {\"I\": 1, \"V\": 5, \"X\": 10, \"L\": 50, \"C\": 100, \"D\": 500, \"M\": 1000}\n total = 0\n prev = 0\n for ch in reversed(s):\n v = values[ch]\n if v < prev:\n total -= v\n else:\n total += v\n prev = v\n return total", "input": "roman_to_int(\"MCMXCIV\")", "language": "Python", "predicted_output": "1994"}}
{"submissionId": "cmsvh4bxd01s3g4p2aarbja9w", "title": "Submission RBJA9W", "payload": {"code": "def eval_rpn(tokens):\n stack = []\n for tok in tokens:\n if tok in (\"+\", \"-\", \"*\", \"/\"):\n b = stack.pop()\n a = stack.pop()\n if tok == \"+\":\n stack.append(a + b)\n elif tok == \"-\":\n stack.append(a - b)\n elif tok == \"*\":\n stack.append(a * b)\n else:\n stack.append(int(a / b))\n else:\n stack.append(int(tok))\n return stack[0]", "input": "eval_rpn([\"2\", \"1\", \"1\", \"+\", \"*\"])", "language": "Python", "predicted_output": "4"}}
{"submissionId": "cmsvh4bxd01s4g4p2cds6wpky", "title": "Submission S6WPKY", "payload": {"code": "class Node:\n def __init__(self, val, nxt=None):\n self.val = val\n self.next = nxt\n\ndef reverse_list(head):\n prev = None\n while head:\n nxt = head.next\n head.next = prev\n prev = head\n head = nxt\n return prev\n\ndef to_list(head):\n out = []\n while head:\n out.append(head.val)\n head = head.next\n return out\n\ndef build(vals):\n head = None\n for v in reversed(vals):\n head = Node(v, head)\n return head\n\ndef run_reverse(vals):\n return to_list(reverse_list(build(vals)))", "input": "run_reverse([1, 2, 3, 4, 5])", "language": "Python", "predicted_output": "[5, 4, 3, 2, 1]"}}
{"submissionId": "cmsvh4bxd01s5g4p2go3kauzs", "title": "Submission 3KAUZS", "payload": {"code": "class TreeNode:\n def __init__(self, val, left=None, right=None):\n self.val = val\n self.left = left\n self.right = right\n\ndef inorder(node):\n if node is None:\n return []\n return inorder(node.left) + [node.val] + inorder(node.right)\n\ndef build_tree():\n return TreeNode(4, TreeNode(2, TreeNode(1), TreeNode(3)), TreeNode(6, TreeNode(5), TreeNode(7)))\n\ndef run_inorder():\n return inorder(build_tree())", "input": "run_inorder()", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7]"}}
{"submissionId": "cmsvh4bxd01s6g4p2f6j83e69", "title": "Submission J83E69", "payload": {"code": "def permutations(lst):\n if len(lst) <= 1:\n return [lst]\n result = []\n for i in range(len(lst)):\n rest = lst[:i] + lst[i + 1:]\n for p in permutations(rest):\n result.append([lst[i]] + p)\n return result", "input": "permutations([1, 2, 3])", "language": "Python", "predicted_output": "[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]"}}
{"submissionId": "cmsvh4bxd01s7g4p22mhu04dn", "title": "Submission HU04DN", "payload": {"code": "def combination_sum(candidates, target):\n result = []\n def backtrack(start, path, remaining):\n if remaining == 0:\n result.append(list(path))\n return\n if remaining < 0:\n return\n for i in range(start, len(candidates)):\n path.append(candidates[i])\n backtrack(i, path, remaining - candidates[i])\n path.pop()\n backtrack(0, [], target)\n return result", "input": "combination_sum([2, 3, 6, 7], 7)", "language": "Python", "predicted_output": "[[2, 2, 3], [7]]"}}
{"submissionId": "cmsvh4bxd01s8g4p24grgeyz1", "title": "Submission RGEYZ1", "payload": {"code": "def knapsack(weights, values, capacity):\n n = len(weights)\n dp = [[0] * (capacity + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n for w in range(capacity + 1):\n if weights[i - 1] <= w:\n dp[i][w] = max(dp[i - 1][w], dp[i - 1][w - weights[i - 1]] + values[i - 1])\n else:\n dp[i][w] = dp[i - 1][w]\n return dp[n][capacity]", "input": "knapsack([1, 3, 4, 5], [1, 4, 5, 7], 7)", "language": "Python", "predicted_output": "9"}}
{"submissionId": "cmsvh4bxd01s9g4p28p9vc6dn", "title": "Submission 9VC6DN", "payload": {"code": "def compress_if_shorter(s):\n if not s:\n return s\n parts = []\n prev = s[0]\n count = 1\n for ch in s[1:]:\n if ch == prev:\n count += 1\n else:\n parts.append(prev + str(count))\n prev = ch\n count = 1\n parts.append(prev + str(count))\n compressed = \"\".join(parts)\n return compressed if len(compressed) < len(s) else s", "input": "compress_if_shorter(\"aabcccccaaa\")", "language": "Python", "predicted_output": "a2b1c5a3"}}
{"submissionId": "cmsvh4bxd01sag4p2vhnssnjd", "title": "Submission NSSNJD", "payload": {"code": "def rotate_matrix(matrix):\n return [list(row) for row in zip(*matrix[::-1])]", "input": "rotate_matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])", "language": "Python", "predicted_output": "[[7, 4, 1], [8, 5, 2], [9, 6, 3]]"}}
{"submissionId": "cmsvh4bxd01sbg4p2ykvr0uv4", "title": "Submission VR0UV4", "payload": {"code": "def unique_paths(m, n):\n dp = [[1] * n for _ in range(m)]\n for i in range(1, m):\n for j in range(1, n):\n dp[i][j] = dp[i - 1][j] + dp[i][j - 1]\n return dp[m - 1][n - 1]", "input": "unique_paths(3, 7)", "language": "Python", "predicted_output": "28"}}
{"submissionId": "cmsvh4bxd01scg4p2knd4r09s", "title": "Submission D4R09S", "payload": {"code": "def edit_distance(a, b):\n m, n = len(a), len(b)\n dp = [[0] * (n + 1) for _ in range(m + 1)]\n for i in range(m + 1):\n dp[i][0] = i\n for j in range(n + 1):\n dp[0][j] = j\n for i in range(1, m + 1):\n for j in range(1, n + 1):\n if a[i - 1] == b[j - 1]:\n dp[i][j] = dp[i - 1][j - 1]\n else:\n dp[i][j] = 1 + min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1])\n return dp[m][n]", "input": "edit_distance(\"horse\", \"ros\")", "language": "Python", "predicted_output": "3"}}
{"submissionId": "cmsvmflok01vmg4p2zoakvz25", "title": "Submission AKVZ25", "payload": {"code": "def is_prime(n):\n if n < 2:\n return False\n for i in range(2, int(n ** 0.5) + 1):\n if n % i == 0:\n return False\n return True", "input": "is_prime(97)", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsvmflok01vng4p25skrn71b", "title": "Submission KRN71B", "payload": {"code": "def fibonacci(n):\n seq = [0, 1]\n for i in range(2, n):\n seq.append(seq[-1] + seq[-2])\n return seq[:n]", "input": "fibonacci(10)", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]"}}
{"submissionId": "cmsvmflok01vog4p29ui9ckr5", "title": "Submission I9CKR5", "payload": {"code": "def mat_mult(a, b):\n result = [[0, 0], [0, 0]]\n for i in range(2):\n for j in range(2):\n for k in range(2):\n result[i][j] += a[i][k] * b[k][j]\n return result", "input": "mat_mult([[1, 2], [3, 4]], [[5, 6], [7, 8]])", "language": "Python", "predicted_output": "[[19, 22], [43, 50]]"}}
{"submissionId": "cmsvmflok01vpg4p28lbtyg12", "title": "Submission BTYG12", "payload": {"code": "def group_anagrams(words):\n groups = {}\n for w in words:\n key = \"\".join(sorted(w))\n groups.setdefault(key, []).append(w)\n return groups", "input": "group_anagrams(['eat', 'tea', 'tan', 'ate', 'nat', 'bat'])", "language": "Python", "predicted_output": "{'aet': ['eat', 'tea', 'ate'], 'ant': ['tan', 'nat'], 'abt': ['bat']}"}}
{"submissionId": "cmsvmflok01vqg4p2grjwr7te", "title": "Submission JWR7TE", "payload": {"code": "def binary_to_decimal(s):\n return int(s, 2)", "input": "binary_to_decimal('110101')", "language": "Python", "predicted_output": "53"}}
{"submissionId": "cmsvmflok01vrg4p2j06uf87l", "title": "Submission 6UF87L", "payload": {"code": "def decimal_to_binary(n):\n if n == 0:\n return '0'\n digits = []\n while n > 0:\n digits.append(str(n % 2))\n n //= 2\n return ''.join(reversed(digits))", "input": "decimal_to_binary(53)", "language": "Python", "predicted_output": "110101"}}
{"submissionId": "cmsvmflok01vsg4p2sxnc0u48", "title": "Submission NC0U48", "payload": {"code": "def gcd_lcm(a, b):\n x, y = a, b\n while y:\n x, y = y, x % y\n gcd = x\n lcm = a * b // gcd\n return (gcd, lcm)", "input": "gcd_lcm(12, 18)", "language": "Python", "predicted_output": "(6, 36)"}}
{"submissionId": "cmsvmflol01vtg4p2wtglqurr", "title": "Submission GLQURR", "payload": {"code": "def compute_zigzag_checksum(values, mod=97):\n total = 0\n direction = 1\n for idx, v in enumerate(values):\n total += direction * (v ** 2 + idx)\n if (idx + 1) % 3 == 0:\n direction *= -1\n return total % mod", "input": "compute_zigzag_checksum([4, 9, 2, 7, 5, 1, 8, 3])", "language": "Python", "predicted_output": "6"}}
{"submissionId": "cmsvmflol01vug4p2qcpu73lp", "title": "Submission PU73LP", "payload": {"code": "def merge_two_sorted(a, b):\n i = j = 0\n result = []\n while i < len(a) and j < len(b):\n if a[i] <= b[j]:\n result.append(a[i])\n i += 1\n else:\n result.append(b[j])\n j += 1\n result.extend(a[i:])\n result.extend(b[j:])\n return result", "input": "merge_two_sorted([1, 4, 7], [2, 3, 8, 9])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 7, 8, 9]"}}
{"submissionId": "cmsvmflol01vvg4p29cttz8ab", "title": "Submission TTZ8AB", "payload": {"code": "def run_length_decode(s):\n result = []\n i = 0\n while i < len(s):\n ch = s[i]\n i += 1\n num_start = i\n while i < len(s) and s[i].isdigit():\n i += 1\n count = int(s[num_start:i])\n result.append(ch * count)\n return ''.join(result)", "input": "run_length_decode('a3b1c5')", "language": "Python", "predicted_output": "aaabccccc"}}
{"submissionId": "cmsvmjjpi01x0g4p2bpkvv869", "title": "Submission KVV869", "payload": {"code": "def roman_to_int(s):\n vals = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}\n total = 0\n for i in range(len(s)):\n v = vals[s[i]]\n if i + 1 < len(s) and v < vals[s[i + 1]]:\n total -= v\n else:\n total += v\n return total", "input": "roman_to_int('MCMXCIV')", "language": "Python", "predicted_output": "1994"}}
{"submissionId": "cmsvmjjpi01x1g4p2xvm4it39", "title": "Submission M4IT39", "payload": {"code": "def valid_brackets(s):\n pairs = {')': '(', ']': '[', '}': '{'}\n stack = []\n for ch in s:\n if ch in '([{':\n stack.append(ch)\n elif ch in pairs:\n if not stack or stack.pop() != pairs[ch]:\n return False\n return not stack", "input": "valid_brackets('a(b[c]{d}e)f')", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsvmjjpi01x2g4p2ot7poq9u", "title": "Submission 7POQ9U", "payload": {"code": "def caesar_decode(text, shift):\n result = []\n for ch in text:\n if ch.isalpha():\n base = ord('A') if ch.isupper() else ord('a')\n result.append(chr((ord(ch) - base - shift) % 26 + base))\n else:\n result.append(ch)\n return ''.join(result)", "input": "caesar_decode('Mjqqt, Btwqi!', 5)", "language": "Python", "predicted_output": "Hello, World!"}}
{"submissionId": "cmsvmjjpi01x3g4p2ntoh7pto", "title": "Submission OH7PTO", "payload": {"code": "class VisitCounter:\n def __init__(self):\n self.counts = {}\n def visit(self, page):\n self.counts[page] = self.counts.get(page, 0) + 1\n return self.counts[page]\n\ndef run_visits(pages):\n vc = VisitCounter()\n return [vc.visit(p) for p in pages]", "input": "run_visits(['home', 'about', 'home', 'home', 'about'])", "language": "Python", "predicted_output": "[1, 1, 2, 3, 2]"}}
{"submissionId": "cmsvmjjpi01x4g4p2k4q8bewz", "title": "Submission Q8BEWZ", "payload": {"code": "def rle(s):\n if not s:\n return \"\"\n out = []\n prev = s[0]\n count = 1\n for ch in s[1:]:\n if ch == prev:\n count += 1\n else:\n out.append(prev + str(count))\n prev = ch\n count = 1\n out.append(prev + str(count))\n return \"\".join(out)", "input": "rle('aaabbbccd')", "language": "Python", "predicted_output": "a3b3c2d1"}}
{"submissionId": "cmsvmjjpi01x5g4p23d3qdkp1", "title": "Submission 3QDKP1", "payload": {"code": "def upper_bound(nums, target):\n lo, hi = 0, len(nums)\n while lo < hi:\n mid = (lo + hi) // 2\n if nums[mid] <= target:\n lo = mid + 1\n else:\n hi = mid\n return lo", "input": "upper_bound([1, 2, 2, 2, 3, 5], 2)", "language": "Python", "predicted_output": "4"}}
{"submissionId": "cmsvmjjpi01x6g4p2scptpsih", "title": "Submission PTPSIH", "payload": {"code": "def flatten_list(lst):\n result = []\n for item in lst:\n if isinstance(item, list):\n result.extend(flatten_list(item))\n else:\n result.append(item)\n return result", "input": "flatten_list([1, [2, [3, 4], 5], [[6]], 7])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7]"}}
{"submissionId": "cmsvmjjpi01x7g4p2u8i9c0m6", "title": "Submission I9C0M6", "payload": {"code": "def dedupe_preserve_order(items):\n seen = set()\n result = []\n for item in items:\n if item not in seen:\n seen.add(item)\n result.append(item)\n return result", "input": "dedupe_preserve_order([3, 1, 2, 3, 1, 4, 2, 5])", "language": "Python", "predicted_output": "[3, 1, 2, 4, 5]"}}
{"submissionId": "cmsvmjjpi01x8g4p25296zhi7", "title": "Submission 96ZHI7", "payload": {"code": "def digit_sum(n):\n n = abs(n)\n if n < 10:\n return n\n return n % 10 + digit_sum(n // 10)", "input": "digit_sum(987654321)", "language": "Python", "predicted_output": "45"}}
{"submissionId": "cmsvmjjpi01x9g4p2mee2vj01", "title": "Submission E2VJ01", "payload": {"code": "def power_set(items):\n result = [[]]\n for item in items:\n result += [subset + [item] for subset in result]\n return sorted(result, key=lambda s: (len(s), s))", "input": "power_set([1, 2, 3])", "language": "Python", "predicted_output": "[[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]"}}
{"submissionId": "cmsvnghm301yfg4p2jzcnjd3l", "title": "Submission CNJD3L", "payload": {"code": "def redact_digits_runs(text, min_run):\n result = []\n i = 0\n n = len(text)\n while i < n:\n if text[i].isdigit():\n j = i\n while j < n and text[j].isdigit():\n j += 1\n run_len = j - i\n if run_len >= min_run:\n result.append(\"*\" * run_len)\n else:\n result.append(text[i:j])\n i = j\n else:\n result.append(text[i])\n i += 1\n return \"\".join(result)", "input": "redact_digits_runs('Card 4242424242424242 exp 12/28 cvv 123', 6)", "language": "Python", "predicted_output": "Card **************** exp 12/28 cvv 123"}}
{"submissionId": "cmsvnghm301ygg4p28eks1oag", "title": "Submission KS1OAG", "payload": {"code": "def has_adjacent_vip_conflict(seating_row, vip_set):\n for i in range(len(seating_row) - 1):\n if seating_row[i] in vip_set and seating_row[i+1] in vip_set:\n return True\n return False", "input": "has_adjacent_vip_conflict(['Ana', 'Ben', 'Cid', 'Dax', 'Eve'], {'Cid', 'Dax', 'Eve'})", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsvnghm301yhg4p2akco3ijq", "title": "Submission CO3IJQ", "payload": {"code": "def process_tasks_with_aging(tasks, boost_after):\n processed = []\n remaining = [dict(t) for t in tasks]\n tick = 0\n while remaining:\n for t in remaining:\n if tick - t[\"submitted\"] >= boost_after and t[\"priority\"] > 1:\n t[\"priority\"] -= 1\n remaining.sort(key=lambda t: (t[\"priority\"], t[\"submitted\"]))\n current = remaining.pop(0)\n processed.append(current[\"name\"])\n tick += 1\n return processed", "input": "process_tasks_with_aging([{'name':'A','priority':3,'submitted':0}, {'name':'B','priority':1,'submitted':1}, {'name':'C','priority':3,'submitted':0}], 2)", "language": "Python", "predicted_output": "['B', 'A', 'C']"}}
{"submissionId": "cmsvnghm301yig4p2pdndfg8c", "title": "Submission NDFG8C", "payload": {"code": "def evaluate_polynomial(coefficients, x):\n result = 0\n for coef in coefficients:\n result = result * x + coef\n return result", "input": "evaluate_polynomial([2, -3, 0, 5], 3)", "language": "Python", "predicted_output": "32"}}
{"submissionId": "cmsvnghm301yjg4p2wlgqxgjz", "title": "Submission GQXGJZ", "payload": {"code": "def compute_backoff_schedule(base_delay, max_delay, attempts):\n schedule = []\n delay = base_delay\n for _ in range(attempts):\n schedule.append(min(delay, max_delay))\n delay *= 2\n return schedule", "input": "compute_backoff_schedule(1, 20, 6)", "language": "Python", "predicted_output": "[1, 2, 4, 8, 16, 20]"}}
{"submissionId": "cmsvnghm301ykg4p2dhktnu7o", "title": "Submission KTNU7O", "payload": {"code": "def nearest_warehouse(warehouses, point):\n best = None\n best_dist = None\n for name, (x, y) in sorted(warehouses.items()):\n dist = abs(x - point[0]) + abs(y - point[1])\n if best_dist is None or dist < best_dist:\n best_dist = dist\n best = name\n return best, best_dist", "input": "nearest_warehouse({'W1': (0,0), 'W2': (5,5), 'W3': (2,3)}, (3,3))", "language": "Python", "predicted_output": "('W3', 1)"}}
{"submissionId": "cmsvnghm301ylg4p2k2h8o7v3", "title": "Submission H8O7V3", "payload": {"code": "def dedupe_events(events, window_seconds):\n result = []\n last_seen = {}\n for event_type, ts in events:\n if event_type in last_seen and ts - last_seen[event_type] < window_seconds:\n continue\n last_seen[event_type] = ts\n result.append((event_type, ts))\n return result", "input": "dedupe_events([('click', 0), ('click', 2), ('hover', 3), ('click', 6), ('click', 7), ('hover', 10)], 5)", "language": "Python", "predicted_output": "[('click', 0), ('hover', 3), ('click', 6), ('hover', 10)]"}}
{"submissionId": "cmsvnghm301ymg4p2scqmrajj", "title": "Submission QMRAJJ", "payload": {"code": "def scale_recipe(ingredients, factor):\n scaled = {}\n for name, amount in ingredients.items():\n new_amount = round(amount * factor, 2)\n scaled[name] = new_amount\n return scaled", "input": "scale_recipe({'flour': 2.5, 'sugar': 1.0, 'eggs': 3, 'butter': 0.75}, 1.5)", "language": "Python", "predicted_output": "{'flour': 3.75, 'sugar': 1.5, 'eggs': 4.5, 'butter': 1.12}"}}
{"submissionId": "cmsvnghm301yng4p2er6xiu56", "title": "Submission 6XIU56", "payload": {"code": "def match_route(routes, path):\n path_parts = path.strip(\"/\").split(\"/\")\n for pattern, handler in routes:\n pattern_parts = pattern.strip(\"/\").split(\"/\")\n if len(pattern_parts) != len(path_parts):\n continue\n params = {}\n matched = True\n for pp, ap in zip(pattern_parts, path_parts):\n if pp.startswith(\":\"):\n params[pp[1:]] = ap\n elif pp != ap:\n matched = False\n break\n if matched:\n return handler, params\n return None, {}", "input": "match_route([('/users/:id', 'get_user'), ('/users/:id/posts/:postId', 'get_post')], '/users/42/posts/7')", "language": "Python", "predicted_output": "('get_post', {'id': '42', 'postId': '7'})"}}
{"submissionId": "cmsvnghm301yog4p28zvuk598", "title": "Submission VUK598", "payload": {"code": "def compare_versions(v1, v2):\n parts1 = [int(x) for x in v1.split(\".\")]\n parts2 = [int(x) for x in v2.split(\".\")]\n length = max(len(parts1), len(parts2))\n parts1 += [0] * (length - len(parts1))\n parts2 += [0] * (length - len(parts2))\n for a, b in zip(parts1, parts2):\n if a != b:\n return 1 if a > b else -1\n return 0", "input": "[compare_versions('1.2.3', '1.2'), compare_versions('2.0', '1.9.9'), compare_versions('1.0.0', '1.0.0')]", "language": "Python", "predicted_output": "[1, 1, 0]"}}
{"submissionId": "cmsvnghm301ypg4p2ztecr1vs", "title": "Submission ECR1VS", "payload": {"code": "def group_duplicate_files(files):\n def simple_hash(content):\n h = 0\n for ch in content:\n h = (h * 31 + ord(ch)) % 1000000007\n return h\n groups = {}\n for name, content in files:\n h = simple_hash(content)\n groups.setdefault(h, []).append(name)\n return sorted([sorted(g) for g in groups.values() if len(g) > 1])", "input": "group_duplicate_files([('a.txt','hello'), ('b.txt','world'), ('c.txt','hello'), ('d.txt','hello'), ('e.txt','unique')])", "language": "Python", "predicted_output": "[['a.txt', 'c.txt', 'd.txt']]"}}
{"submissionId": "cmsvnghm301yqg4p2yuzplvdv", "title": "Submission ZPLVDV", "payload": {"code": "def weighted_round_robin(servers, num_requests):\n current_weights = {name: 0 for name, _ in servers}\n total_weight = sum(w for _, w in servers)\n assignments = []\n for _ in range(num_requests):\n for name, weight in servers:\n current_weights[name] += weight\n chosen = max(current_weights, key=lambda k: current_weights[k])\n current_weights[chosen] -= total_weight\n assignments.append(chosen)\n return assignments", "input": "weighted_round_robin([('A', 5), ('B', 1), ('C', 1)], 7)", "language": "Python", "predicted_output": "['A', 'A', 'B', 'A', 'C', 'A', 'A']"}}
{"submissionId": "cmsvnghm301yrg4p2nrlkyind", "title": "Submission LKYIND", "payload": {"code": "def count_palindromic_substrings_min_length(s, min_length):\n count = 0\n n = len(s)\n for i in range(n):\n for j in range(i + min_length, n + 1):\n sub = s[i:j]\n if sub == sub[::-1]:\n count += 1\n return count", "input": "count_palindromic_substrings_min_length('abaaba', 3)", "language": "Python", "predicted_output": "4"}}
{"submissionId": "cmsvnghm301ysg4p2ftjgc0vu", "title": "Submission JGC0VU", "payload": {"code": "def detect_spikes(readings, window, threshold):\n spikes = []\n for i in range(len(readings)):\n start = max(0, i - window)\n history = readings[start:i]\n if not history:\n continue\n avg = sum(history) / len(history)\n if abs(readings[i] - avg) > threshold:\n spikes.append(i)\n return spikes", "input": "detect_spikes([20, 21, 19, 22, 55, 20, 21, 60, 19], 3, 10)", "language": "Python", "predicted_output": "[4, 5, 6, 7, 8]"}}
{"submissionId": "cmsvnghm301ytg4p2f9zj3gm0", "title": "Submission ZJ3GM0", "payload": {"code": "def compute_standings(matches):\n table = {}\n for home, away, home_score, away_score in matches:\n for team in (home, away):\n table.setdefault(team, {\"points\": 0, \"gd\": 0})\n if home_score > away_score:\n table[home][\"points\"] += 3\n elif away_score > home_score:\n table[away][\"points\"] += 3\n else:\n table[home][\"points\"] += 1\n table[away][\"points\"] += 1\n table[home][\"gd\"] += home_score - away_score\n table[away][\"gd\"] += away_score - home_score\n ranked = sorted(table.items(), key=lambda kv: (-kv[1][\"points\"], -kv[1][\"gd\"]))\n return [name for name, _ in ranked]", "input": "compute_standings([('A','B',2,1), ('C','D',0,0), ('B','C',3,1), ('A','D',1,1)])", "language": "Python", "predicted_output": "['A', 'B', 'D', 'C']"}}
{"submissionId": "cmsvnghm301yug4p2z7tiq3lq", "title": "Submission TIQ3LQ", "payload": {"code": "def wrap_text(words, width):\n lines = []\n current = []\n current_len = 0\n for word in words:\n extra = len(word) + (1 if current else 0)\n if current_len + extra > width:\n lines.append(\" \".join(current))\n current = [word]\n current_len = len(word)\n else:\n current.append(word)\n current_len += extra\n if current:\n lines.append(\" \".join(current))\n return lines", "input": "wrap_text(['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'], 12)", "language": "Python", "predicted_output": "['The quick', 'brown fox', 'jumps over', 'the lazy dog']"}}
{"submissionId": "cmsvnghm301yvg4p2gvqpajb4", "title": "Submission QPAJB4", "payload": {"code": "def order_pick_path(items_by_aisle):\n aisles = sorted(items_by_aisle.keys())\n path = []\n for idx, aisle in enumerate(aisles):\n bins = sorted(items_by_aisle[aisle])\n if idx % 2 == 1:\n bins = bins[::-1]\n for b in bins:\n path.append((aisle, b))\n return path", "input": "order_pick_path({1: [3, 1, 2], 2: [5, 4], 3: [7, 6, 8]})", "language": "Python", "predicted_output": "[(1, 1), (1, 2), (1, 3), (2, 5), (2, 4), (3, 6), (3, 7), (3, 8)]"}}
{"submissionId": "cmsvnghm301ywg4p23r5hik5j", "title": "Submission 5HIK5J", "payload": {"code": "def rank_word_frequency(text, top_n):\n words = text.lower().split()\n freq = {}\n order = {}\n for i, w in enumerate(words):\n w = w.strip(\".,!?\")\n if w not in freq:\n order[w] = i\n freq[w] = freq.get(w, 0) + 1\n ranked = sorted(freq.items(), key=lambda kv: (-kv[1], order[kv[0]]))\n return ranked[:top_n]", "input": "rank_word_frequency('the quick fox jumps the lazy fox the fox runs', 2)", "language": "Python", "predicted_output": "[('the', 3), ('fox', 3)]"}}
{"submissionId": "cmsvnghm301yxg4p2pmfuckys", "title": "Submission FUCKYS", "payload": {"code": "def find_overlapping_shifts(shifts):\n conflicts = []\n sorted_shifts = sorted(shifts, key=lambda s: s[1])\n for i in range(len(sorted_shifts)):\n for j in range(i + 1, len(sorted_shifts)):\n name_i, start_i, end_i = sorted_shifts[i]\n name_j, start_j, end_j = sorted_shifts[j]\n if name_i == name_j and start_j < end_i:\n conflicts.append((name_i, (start_i, end_i), (start_j, end_j)))\n return conflicts", "input": "find_overlapping_shifts([('Sam', 9, 17), ('Sam', 16, 20), ('Lee', 8, 12), ('Lee', 13, 18)])", "language": "Python", "predicted_output": "[('Sam', (9, 17), (16, 20))]"}}
{"submissionId": "cmsvnghm301yyg4p2uno6sesp", "title": "Submission O6SESP", "payload": {"code": "def validate_order_transitions(transitions):\n allowed = {\n \"created\": {\"paid\", \"cancelled\"},\n \"paid\": {\"shipped\", \"refunded\"},\n \"shipped\": {\"delivered\", \"returned\"},\n \"delivered\": set(),\n \"cancelled\": set(),\n \"refunded\": set(),\n \"returned\": {\"refunded\"},\n }\n state = \"created\"\n for next_state in transitions:\n if next_state not in allowed.get(state, set()):\n return f\"invalid transition: {state} -> {next_state}\"\n state = next_state\n return state", "input": "validate_order_transitions(['paid', 'shipped', 'delivered'])", "language": "Python", "predicted_output": "delivered"}}
{"submissionId": "cmsvntqa30218g4p2bperzaeg", "title": "Submission ERZAEG", "payload": {"code": "def safe_transpose(matrix):\n if not matrix:\n return []\n row_len = len(matrix[0])\n for row in matrix:\n if len(row) != row_len:\n raise ValueError(\"Jagged matrix cannot be transposed\")\n return [[matrix[r][c] for r in range(len(matrix))] for c in range(row_len)]", "input": "safe_transpose([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "[[1, 4], [2, 5], [3, 6]]"}}
{"submissionId": "cmsvntqa30219g4p29upct5uf", "title": "Submission PCT5UF", "payload": {"code": "def count_allowed_requests(timestamps, window_size, max_requests):\n allowed = []\n window = []\n for t in timestamps:\n window = [w for w in window if t - w < window_size]\n if len(window) < max_requests:\n window.append(t)\n allowed.append(t)\n return allowed", "input": "count_allowed_requests([1,2,3,4,10,11,12,20], 5, 3)", "language": "Python", "predicted_output": "[1, 2, 3, 10, 11, 12, 20]"}}
{"submissionId": "cmsvntqa3021ag4p2yduxxjms", "title": "Submission UXXJMS", "payload": {"code": "def flatten_dict(d, prefix=\"\"):\n result = {}\n for key, value in d.items():\n full_key = f\"{prefix}.{key}\" if prefix else key\n if isinstance(value, dict):\n result.update(flatten_dict(value, full_key))\n else:\n result[full_key] = value\n return result", "input": "flatten_dict({'user': {'name': 'Ana', 'address': {'city': 'Reno', 'zip': '89501'}}, 'active': True})", "language": "Python", "predicted_output": "{'user.name': 'Ana', 'user.address.city': 'Reno', 'user.address.zip': '89501', 'active': True}"}}
{"submissionId": "cmsvntqa3021bg4p2m0o078jt", "title": "Submission O078JT", "payload": {"code": "def merge_playlists(playlist_a, playlist_b):\n i = j = 0\n merged = []\n while i < len(playlist_a) and j < len(playlist_b):\n if playlist_a[i][1] <= playlist_b[j][1]:\n merged.append(playlist_a[i])\n i += 1\n else:\n merged.append(playlist_b[j])\n j += 1\n merged.extend(playlist_a[i:])\n merged.extend(playlist_b[j:])\n return merged", "input": "merge_playlists([('SongA', 10), ('SongC', 30)], [('SongB', 20), ('SongD', 25), ('SongE', 40)])", "language": "Python", "predicted_output": "[('SongA', 10), ('SongB', 20), ('SongD', 25), ('SongC', 30), ('SongE', 40)]"}}
{"submissionId": "cmsvntqa3021cg4p276rfekcs", "title": "Submission RFEKCS", "payload": {"code": "def compute_company_checksum(digits):\n weights = [7, 3, 1, 9, 7, 3, 1]\n total = sum(d * w for d, w in zip(digits, weights[:len(digits)]))\n return total % 11", "input": "compute_company_checksum([4, 2, 7, 1, 9, 0, 3])", "language": "Python", "predicted_output": "6"}}
{"submissionId": "cmsvntqa3021dg4p2dihdig5x", "title": "Submission HDIG5X", "payload": {"code": "def round_robin_schedule(tasks, quantum):\n from collections import deque\n queue = deque((name, burst) for name, burst in tasks)\n time = 0\n order = []\n while queue:\n name, burst = queue.popleft()\n run_time = min(quantum, burst)\n time += run_time\n remaining = burst - run_time\n order.append((name, time))\n if remaining > 0:\n queue.append((name, remaining))\n return order", "input": "round_robin_schedule([('P1', 5), ('P2', 3), ('P3', 8)], 4)", "language": "Python", "predicted_output": "[('P1', 4), ('P2', 7), ('P3', 11), ('P1', 12), ('P3', 16)]"}}
{"submissionId": "cmsvntqa3021eg4p2h5xkneng", "title": "Submission XKNENG", "payload": {"code": "def split_csv_row(row):\n fields = []\n current = \"\"\n in_quotes = False\n i = 0\n while i < len(row):\n ch = row[i]\n if ch == '\"':\n in_quotes = not in_quotes\n elif ch == ',' and not in_quotes:\n fields.append(current)\n current = \"\"\n else:\n current += ch\n i += 1\n fields.append(current)\n return fields", "input": "split_csv_row('John,\"Doe, Jr.\",42,\"New York, NY\"')", "language": "Python", "predicted_output": "['John', 'Doe, Jr.', '42', 'New York, NY']"}}
{"submissionId": "cmsvntqa3021fg4p2j3b7pdvo", "title": "Submission B7PDVO", "payload": {"code": "def longest_login_streak(dates):\n from datetime import datetime\n parsed = sorted(datetime.strptime(d, \"%Y-%m-%d\") for d in set(dates))\n longest = 1 if parsed else 0\n current = 1\n for i in range(1, len(parsed)):\n if (parsed[i] - parsed[i-1]).days == 1:\n current += 1\n longest = max(longest, current)\n else:\n current = 1\n return longest", "input": "longest_login_streak(['2026-01-01','2026-01-02','2026-01-03','2026-01-05','2026-01-06','2026-01-07','2026-01-08'])", "language": "Python", "predicted_output": "4"}}
{"submissionId": "cmsvntqa3021gg4p21zlzifwu", "title": "Submission LZIFWU", "payload": {"code": "def evaluate_expression(expr):\n tokens = []\n num = \"\"\n for ch in expr.replace(\" \", \"\"):\n if ch.isdigit() or ch == \".\":\n num += ch\n else:\n if num:\n tokens.append(float(num))\n num = \"\"\n tokens.append(ch)\n if num:\n tokens.append(float(num))\n\n def apply_ops(values, ops):\n b = values.pop()\n a = values.pop()\n op = ops.pop()\n if op == \"+\": values.append(a + b)\n elif op == \"-\": values.append(a - b)\n elif op == \"*\": values.append(a * b)\n elif op == \"/\": values.append(a / b)\n\n values, ops = [], []\n precedence = {\"+\": 1, \"-\": 1, \"*\": 2, \"/\": 2}\n for tok in tokens:\n if isinstance(tok, float):\n values.append(tok)\n else:\n while ops and precedence.get(ops[-1], 0) >= precedence.get(tok, 0):\n apply_ops(values, ops)\n ops.append(tok)\n while ops:\n apply_ops(values, ops)\n result = values[0]\n return int(result) if result == int(result) else result", "input": "evaluate_expression('3 + 4 * 2 - 6 / 3')", "language": "Python", "predicted_output": "9"}}
{"submissionId": "cmsvntqa3021hg4p2ovxnx3j8", "title": "Submission XNX3J8", "payload": {"code": "def dispatch_elevator(elevator_positions, call_floor, direction):\n best_idx = None\n best_dist = None\n for i, (pos, moving_dir) in enumerate(elevator_positions):\n if moving_dir == \"idle\" or moving_dir == direction:\n dist = abs(pos - call_floor)\n if best_dist is None or dist < best_dist:\n best_dist = dist\n best_idx = i\n return best_idx", "input": "dispatch_elevator([(1, 'idle'), (5, 'up'), (10, 'down')], 6, 'up')", "language": "Python", "predicted_output": "1"}}
{"submissionId": "cmsvntqa3021ig4p229ukkrsm", "title": "Submission UKKRSM", "payload": {"code": "def compute_reorder_points(items):\n result = {}\n for name, daily_sales, lead_time_days, safety_stock in items:\n reorder_point = daily_sales * lead_time_days + safety_stock\n result[name] = reorder_point\n return result", "input": "compute_reorder_points([('widget', 12, 5, 20), ('gadget', 3, 10, 5), ('gizmo', 25, 2, 0)])", "language": "Python", "predicted_output": "{'widget': 80, 'gadget': 35, 'gizmo': 50}"}}
{"submissionId": "cmsvntqa3021jg4p2ctwcbsyz", "title": "Submission WCBSYZ", "payload": {"code": "def bucket_students_by_grade(students):\n buckets = {\"A\": [], \"B\": [], \"C\": [], \"D/F\": []}\n for name, score in students:\n if score >= 90:\n buckets[\"A\"].append(name)\n elif score >= 80:\n buckets[\"B\"].append(name)\n elif score >= 70:\n buckets[\"C\"].append(name)\n else:\n buckets[\"D/F\"].append(name)\n averages = {}\n for grade, names in buckets.items():\n scores = [s for n, s in students if n in names]\n averages[grade] = round(sum(scores) / len(scores), 1) if scores else None\n return averages", "input": "bucket_students_by_grade([('Ana', 95), ('Ben', 82), ('Cid', 71), ('Dan', 60), ('Eve', 88), ('Fay', 91)])", "language": "Python", "predicted_output": "{'A': 93.0, 'B': 85.0, 'C': 71.0, 'D/F': 60.0}"}}
{"submissionId": "cmsvntqa3021kg4p2gclhk2ed", "title": "Submission LHK2ED", "payload": {"code": "def normalize_and_dedupe_contacts(raw_numbers):\n seen = set()\n result = []\n for raw in raw_numbers:\n digits = \"\".join(ch for ch in raw if ch.isdigit())\n if len(digits) == 11 and digits.startswith(\"1\"):\n digits = digits[1:]\n if len(digits) != 10:\n continue\n formatted = f\"({digits[0:3]}) {digits[3:6]}-{digits[6:10]}\"\n if formatted not in seen:\n seen.add(formatted)\n result.append(formatted)\n return result", "input": "normalize_and_dedupe_contacts(['415-555-0132', '(415) 555-0132', '1-415-555-0199', '555-0199', '4155550199'])", "language": "Python", "predicted_output": "['(415) 555-0132', '(415) 555-0199']"}}
{"submissionId": "cmsvntqa3021lg4p2664q7xjl", "title": "Submission 4Q7XJL", "payload": {"code": "def shipping_cost(weight_kg, distance_km):\n if weight_kg <= 1:\n base = 5.0\n elif weight_kg <= 5:\n base = 5.0 + (weight_kg - 1) * 1.5\n else:\n base = 11.0 + (weight_kg - 5) * 2.0\n if distance_km > 500:\n base *= 1.4\n elif distance_km > 100:\n base *= 1.15\n return round(base, 2)", "input": "[shipping_cost(0.5, 50), shipping_cost(3, 200), shipping_cost(8, 800)]", "language": "Python", "predicted_output": "[5.0, 9.2, 23.8]"}}
{"submissionId": "cmsvntqa3021mg4p22s63nj0g", "title": "Submission 63NJ0G", "payload": {"code": "def find_cyclic_targets(dependencies):\n graph = {}\n for src, dst in dependencies:\n graph.setdefault(src, []).append(dst)\n graph.setdefault(dst, [])\n state = {}\n cyclic = set()\n\n def dfs(node, path):\n state[node] = \"visiting\"\n path.append(node)\n for nxt in graph.get(node, []):\n if state.get(nxt) == \"visiting\":\n cycle_start = path.index(nxt)\n cyclic.update(path[cycle_start:])\n elif state.get(nxt) != \"done\":\n dfs(nxt, path)\n path.pop()\n state[node] = \"done\"\n\n for node in list(graph):\n if state.get(node) is None:\n dfs(node, [])\n return sorted(cyclic)", "input": "find_cyclic_targets([('build','compile'),('compile','link'),('link','build'),('test','compile'),('deploy','test')])", "language": "Python", "predicted_output": "['build', 'compile', 'link']"}}
{"submissionId": "cmsvntqa3021ng4p2p6otthut", "title": "Submission OTTHUT", "payload": {"code": "def process_ledger(transactions, overdraft_limit):\n balance = 0\n declined = []\n for desc, amount in transactions:\n if balance + amount < -overdraft_limit:\n declined.append(desc)\n continue\n balance += amount\n return balance, declined", "input": "process_ledger([('deposit', 100), ('rent', -300), ('paycheck', 150), ('groceries', -60), ('car payment', -250)], 200)", "language": "Python", "predicted_output": "(-110, ['car payment'])"}}
{"submissionId": "cmsvntqa3021og4p2j1wueozd", "title": "Submission WUEOZD", "payload": {"code": "def merge_meetings_with_buffer(meetings, buffer_minutes):\n if not meetings:\n return []\n sorted_meetings = sorted(meetings)\n merged = [list(sorted_meetings[0])]\n for start, end in sorted_meetings[1:]:\n last_start, last_end = merged[-1]\n if start <= last_end + buffer_minutes:\n merged[-1][1] = max(last_end, end)\n else:\n merged.append([start, end])\n return [tuple(m) for m in merged]", "input": "merge_meetings_with_buffer([(9,10),(10,11),(13,14),(14,16),(20,21)], 15)", "language": "Python", "predicted_output": "[(9, 21)]"}}
{"submissionId": "cmsvntqa3021pg4p2cjgd394y", "title": "Submission GD394Y", "payload": {"code": "class FrequencyCache:\n def __init__(self, capacity):\n self.capacity = capacity\n self.store = {}\n self.freq = {}\n\n def put(self, key, value):\n if key in self.store:\n self.store[key] = value\n self.freq[key] += 1\n return\n if len(self.store) >= self.capacity:\n least_key = min(self.freq, key=lambda k: self.freq[k])\n del self.store[least_key]\n del self.freq[least_key]\n self.store[key] = value\n self.freq[key] = 1\n\n def get(self, key):\n if key not in self.store:\n return None\n self.freq[key] += 1\n return self.store[key]\n\ndef run_cache_ops(ops):\n cache = FrequencyCache(2)\n results = []\n for op in ops:\n if op[0] == \"put\":\n cache.put(op[1], op[2])\n results.append(None)\n else:\n results.append(cache.get(op[1]))\n return results", "input": "run_cache_ops([('put','a',1),('put','b',2),('get','a'),('put','c',3),('get','b'),('get','c')])", "language": "Python", "predicted_output": "[None, None, 1, None, None, 3]"}}
{"submissionId": "cmsvntqa3021qg4p2o5t39asc", "title": "Submission T39ASC", "payload": {"code": "def weighted_moving_average(values, weights):\n n = len(weights)\n result = []\n for i in range(len(values)):\n window = []\n window_weights = []\n for j in range(n):\n idx = i - (n // 2) + j\n if 0 <= idx < len(values):\n window.append(values[idx])\n window_weights.append(weights[j])\n total_weight = sum(window_weights)\n weighted_sum = sum(v * w for v, w in zip(window, window_weights))\n result.append(round(weighted_sum / total_weight, 2))\n return result", "input": "weighted_moving_average([10, 12, 9, 14, 20, 18], [1, 2, 1])", "language": "Python", "predicted_output": "[10.67, 10.75, 11.0, 14.25, 18.0, 18.67]"}}
{"submissionId": "cmsvntqa3021rg4p24yz9djnt", "title": "Submission Z9DJNT", "payload": {"code": "def count_log_levels_by_service(log_lines):\n counts = {}\n for line in log_lines:\n parts = line.split(\" \", 2)\n if len(parts) < 3:\n continue\n service, level = parts[0], parts[1]\n counts.setdefault(service, {})\n counts[service][level] = counts[service].get(level, 0) + 1\n return counts", "input": "count_log_levels_by_service(['auth WARN token expiring', 'auth ERROR login failed', 'billing INFO charge ok', 'auth ERROR login failed', 'billing ERROR timeout'])", "language": "Python", "predicted_output": "{'auth': {'WARN': 1, 'ERROR': 2}, 'billing': {'INFO': 1, 'ERROR': 1}}"}}
{"submissionId": "cmsvobe4z0272g4p2ffjxwumd", "title": "Submission JXWUMD", "payload": {"code": "def reverse_evens(nums):\n return nums[::-2]\n", "input": "reverse_evens([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])", "language": "Python", "predicted_output": "[10, 8, 6, 4, 2]"}}
{"submissionId": "cmsvobe4z0273g4p2ffo7uy5n", "title": "Submission O7UY5N", "payload": {"code": "def repeat_join(words, n):\n return '-'.join(words) * n\n", "input": "repeat_join(['a', 'b'], 2)", "language": "Python", "predicted_output": "a-ba-b"}}
{"submissionId": "cmsvobe4z0274g4p270o28upm", "title": "Submission O28UPM", "payload": {"code": "def transform(d):\n return {k: (v * 2 if v % 2 == 0 else v) for k, v in d.items()}\n", "input": "transform({'a': 1, 'b': 2, 'c': 3, 'd': 4})", "language": "Python", "predicted_output": "{'a': 1, 'b': 4, 'c': 3, 'd': 8}"}}
{"submissionId": "cmsvobe4z0275g4p2olwpi9ya", "title": "Submission WPI9YA", "payload": {"code": "def classify(n):\n try:\n result = 10 / n\n except ZeroDivisionError:\n return 'undefined'\n else:\n return f'ok:{result}'\n", "input": "(classify(5), classify(0))", "language": "Python", "predicted_output": "('ok:2.0', 'undefined')"}}
{"submissionId": "cmsvobe4z0276g4p2icrwj8hr", "title": "Submission RWJ8HR", "payload": {"code": "def pairs(n):\n return [(i, j) for i in range(n) for j in range(i) if (i + j) % 2 == 0]\n", "input": "pairs(4)", "language": "Python", "predicted_output": "[(2, 0), (3, 1)]"}}
{"submissionId": "cmsvobe4z0277g4p2waw08gmi", "title": "Submission W08GMI", "payload": {"code": "def center_text(s, width):\n return s.center(width, '*')\n", "input": "center_text('hi', 6)", "language": "Python", "predicted_output": "**hi**"}}
{"submissionId": "cmsvobe4z0278g4p2xgk64tgq", "title": "Submission K64TGQ", "payload": {"code": "def fib(n, memo={}):\n if n in memo:\n return memo[n]\n if n <= 1:\n return n\n memo[n] = fib(n - 1, memo) + fib(n - 2, memo)\n return memo[n]\n", "input": "fib(10)", "language": "Python", "predicted_output": "55"}}
{"submissionId": "cmsvobe4z0279g4p2lotasn3z", "title": "Submission TASN3Z", "payload": {"code": "def split_first_last(items):\n first, *middle, last = items\n return (first, middle, last)\n", "input": "split_first_last([1, 2, 3, 4, 5])", "language": "Python", "predicted_output": "(1, [2, 3, 4], 5)"}}
{"submissionId": "cmsvobe4z027ag4p2t4yj2p41", "title": "Submission YJ2P41", "payload": {"code": "def analyze(a, b):\n return (sorted(a | b), sorted(a & b), sorted(a - b))\n", "input": "analyze({1, 2, 3}, {2, 3, 4})", "language": "Python", "predicted_output": "([1, 2, 3, 4], [2, 3], [1])"}}
{"submissionId": "cmsvobe4z027bg4p27d3p075i", "title": "Submission 3P075I", "payload": {"code": "def parse_key_value(s):\n key, value = s.split('=', 1)\n return (key.strip(), value.strip())\n", "input": "parse_key_value(' name = John Smith = extra ')", "language": "Python", "predicted_output": "('name', 'John Smith = extra')"}}
{"submissionId": "cmsvonedl027wg4p2g4tzhb6o", "title": "Submission TZHB6O", "payload": {"code": "\ndef fib(n, memo=None):\n if memo is None:\n memo = {}\n if n in memo:\n return memo[n]\n if n <= 1:\n return n\n memo[n] = fib(n - 1, memo) + fib(n - 2, memo)\n return memo[n]\n", "input": "fib(20)", "language": "Python", "predicted_output": "6765"}}
{"submissionId": "cmsvonedl027xg4p28tyxe2j9", "title": "Submission YXE2J9", "payload": {"code": "\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n", "input": "gcd(252, 105)", "language": "Python", "predicted_output": "21"}}
{"submissionId": "cmsvonedl027yg4p2ara94qv0", "title": "Submission A94QV0", "payload": {"code": "\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n", "input": "lcm(4, 6)", "language": "Python", "predicted_output": "12"}}
{"submissionId": "cmsvonedl027zg4p2wd2bpk14", "title": "Submission 2BPK14", "payload": {"code": "\ndef is_palindrome(s):\n cleaned = ''.join(ch.lower() for ch in s if ch.isalnum())\n return cleaned == cleaned[::-1]\n", "input": "is_palindrome('A man a plan a canal Panama')", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsvonedl0280g4p2w4c5fq1l", "title": "Submission C5FQ1L", "payload": {"code": "\ndef run_length_encode(s):\n if not s:\n return ''\n result = []\n prev = s[0]\n count = 1\n for ch in s[1:]:\n if ch == prev:\n count += 1\n else:\n result.append(prev + str(count))\n prev = ch\n count = 1\n result.append(prev + str(count))\n return ''.join(result)\n", "input": "run_length_encode('aaabbbccd')", "language": "Python", "predicted_output": "a3b3c2d1"}}
{"submissionId": "cmsvonedl0281g4p22e1tvplf", "title": "Submission 1TVPLF", "payload": {"code": "\ndef digit_sum(n):\n return sum(int(d) for d in str(n))\n", "input": "digit_sum(987654)", "language": "Python", "predicted_output": "39"}}
{"submissionId": "cmsvonedl0282g4p29wy6lb27", "title": "Submission Y6LB27", "payload": {"code": "\ndef reverse_int(n):\n sign = -1 if n < 0 else 1\n rev = int(str(abs(n))[::-1])\n return sign * rev\n", "input": "reverse_int(-12345)", "language": "Python", "predicted_output": "-54321"}}
{"submissionId": "cmsvonedl0283g4p2a8kjnfin", "title": "Submission KJNFIN", "payload": {"code": "\ndef is_perfect(n):\n divisors_sum = sum(i for i in range(1, n) if n % i == 0)\n return divisors_sum == n\n", "input": "is_perfect(28)", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsvonedl0284g4p2qjnz01m9", "title": "Submission NZ01M9", "payload": {"code": "\ndef is_armstrong(n):\n digits = str(n)\n power = len(digits)\n return n == sum(int(d) ** power for d in digits)\n", "input": "is_armstrong(153)", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsvonedl0285g4p2tqjo6ayr", "title": "Submission JO6AYR", "payload": {"code": "\ndef binary_to_decimal(s):\n return int(s, 2)\n", "input": "binary_to_decimal('110110')", "language": "Python", "predicted_output": "54"}}
{"submissionId": "cmsvonedl0286g4p29jv5wyy2", "title": "Submission V5WYY2", "payload": {"code": "\ndef decimal_to_binary(n):\n if n == 0:\n return '0'\n bits = []\n while n > 0:\n bits.append(str(n % 2))\n n //= 2\n return ''.join(reversed(bits))\n", "input": "decimal_to_binary(233)", "language": "Python", "predicted_output": "11101001"}}
{"submissionId": "cmsvonedl0287g4p2y2ykqh0r", "title": "Submission YKQH0R", "payload": {"code": "\ndef count_set_bits(n):\n count = 0\n while n:\n count += n & 1\n n >>= 1\n return count\n", "input": "count_set_bits(255)", "language": "python", "predicted_output": "8"}}
{"submissionId": "cmsvonedl0288g4p26p7q62on", "title": "Submission 7Q62ON", "payload": {"code": "\ndef permutations_of(items):\n if len(items) <= 1:\n return [items]\n result = []\n for i in range(len(items)):\n rest = items[:i] + items[i + 1:]\n for p in permutations_of(rest):\n result.append([items[i]] + p)\n return result\n", "input": "permutations_of([1, 2, 3])", "language": "python", "predicted_output": "[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]"}}
{"submissionId": "cmsvonedl0289g4p2ce8jc32r", "title": "Submission 8JC32R", "payload": {"code": "\nimport math\n\ndef n_choose_r(n, r):\n return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))\n", "input": "n_choose_r(10, 3)", "language": "python", "predicted_output": "120"}}
{"submissionId": "cmsvonedl028ag4p29ab51vur", "title": "Submission B51VUR", "payload": {"code": "\ndef rotate_matrix_clockwise(matrix):\n n = len(matrix)\n m = len(matrix[0])\n result = [[None] * n for _ in range(m)]\n for i in range(n):\n for j in range(m):\n result[j][n - 1 - i] = matrix[i][j]\n return result\n", "input": "rotate_matrix_clockwise([[1, 2, 3], [4, 5, 6]])", "language": "python", "predicted_output": "[[4, 1], [5, 2], [6, 3]]"}}
{"submissionId": "cmsvonedl028bg4p2tc49c7un", "title": "Submission 49C7UN", "payload": {"code": "\ndef matmul(a, b):\n rows_a = len(a)\n cols_a = len(a[0])\n cols_b = len(b[0])\n result = [[0] * cols_b for _ in range(rows_a)]\n for i in range(rows_a):\n for j in range(cols_b):\n for k in range(cols_a):\n result[i][j] += a[i][k] * b[k][j]\n return result\n", "input": "matmul([[1, 2], [3, 4]], [[5, 6], [7, 8]])", "language": "python", "predicted_output": "[[19, 22], [43, 50]]"}}
{"submissionId": "cmsvonedl028cg4p2ak6r9gqw", "title": "Submission 6R9GQW", "payload": {"code": "\ndef bubble_sort(arr):\n arr = list(arr)\n n = len(arr)\n for i in range(n):\n for j in range(0, n - i - 1):\n if arr[j] > arr[j + 1]:\n arr[j], arr[j + 1] = arr[j + 1], arr[j]\n return arr\n", "input": "bubble_sort([5, 2, 8, 1, 9, 3])", "language": "python", "predicted_output": "[1, 2, 3, 5, 8, 9]"}}
{"submissionId": "cmsvonedl028dg4p2npa3un1l", "title": "Submission A3UN1L", "payload": {"code": "\ndef selection_sort(arr):\n arr = list(arr)\n n = len(arr)\n for i in range(n):\n min_idx = i\n for j in range(i + 1, n):\n if arr[j] < arr[min_idx]:\n min_idx = j\n arr[i], arr[min_idx] = arr[min_idx], arr[i]\n return arr\n", "input": "selection_sort([64, 25, 12, 22, 11])", "language": "python", "predicted_output": "[11, 12, 22, 25, 64]"}}
{"submissionId": "cmsvonedl028eg4p2j997xe73", "title": "Submission 97XE73", "payload": {"code": "\ndef insertion_sort(arr):\n arr = list(arr)\n for i in range(1, len(arr)):\n key = arr[i]\n j = i - 1\n while j >= 0 and arr[j] > key:\n arr[j + 1] = arr[j]\n j -= 1\n arr[j + 1] = key\n return arr\n", "input": "insertion_sort([12, 11, 13, 5, 6])", "language": "python", "predicted_output": "[5, 6, 11, 12, 13]"}}
{"submissionId": "cmsvonedl028fg4p2yonk8bfx", "title": "Submission NK8BFX", "payload": {"code": "\ndef quick_sort(arr):\n if len(arr) <= 1:\n return list(arr)\n pivot = arr[len(arr) // 2]\n left = [x for x in arr if x < pivot]\n mid = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quick_sort(left) + mid + quick_sort(right)\n", "input": "quick_sort([10, 7, 8, 9, 1, 5])", "language": "python", "predicted_output": "[1, 5, 7, 8, 9, 10]"}}
{"submissionId": "cmsvonedl028gg4p2h1ogpovk", "title": "Submission OGPOVK", "payload": {"code": "\ndef merge_sort(arr):\n if len(arr) <= 1:\n return list(arr)\n mid = len(arr) // 2\n left = merge_sort(arr[:mid])\n right = merge_sort(arr[mid:])\n result = []\n i = j = 0\n while i < len(left) and j < len(right):\n if left[i] <= right[j]:\n result.append(left[i])\n i += 1\n else:\n result.append(right[j])\n j += 1\n result.extend(left[i:])\n result.extend(right[j:])\n return result\n", "input": "merge_sort([38, 27, 43, 3, 9, 82, 10])", "language": "python", "predicted_output": "[3, 9, 10, 27, 38, 43, 82]"}}
{"submissionId": "cmsvonedl028hg4p2n98ack4e", "title": "Submission 8ACK4E", "payload": {"code": "\ndef search_rotated(nums, target):\n lo, hi = 0, len(nums) - 1\n while lo <= hi:\n mid = (lo + hi) // 2\n if nums[mid] == target:\n return mid\n if nums[lo] <= nums[mid]:\n if nums[lo] <= target < nums[mid]:\n hi = mid - 1\n else:\n lo = mid + 1\n else:\n if nums[mid] < target <= nums[hi]:\n lo = mid + 1\n else:\n hi = mid - 1\n return -1\n", "input": "search_rotated([4, 5, 6, 7, 0, 1, 2], 0)", "language": "python", "predicted_output": "4"}}
{"submissionId": "cmsvonedl028ig4p2fsys7y2i", "title": "Submission YS7Y2I", "payload": {"code": "\ndef find_median(a, b):\n merged = sorted(a + b)\n n = len(merged)\n mid = n // 2\n if n % 2 == 0:\n return (merged[mid - 1] + merged[mid]) / 2\n return float(merged[mid])\n", "input": "find_median([1, 3], [2, 7, 8])", "language": "python", "predicted_output": "3.0"}}
{"submissionId": "cmsvonedl028kg4p2h7x11ehi", "title": "Submission X11EHI", "payload": {"code": "\ndef run_length_encode(s):\n if not s:\n return []\n result = []\n prev = s[0]\n count = 1\n for ch in s[1:]:\n if ch == prev:\n count += 1\n else:\n result.append((prev, count))\n prev = ch\n count = 1\n result.append((prev, count))\n return result\n", "input": "run_length_encode('aaabbbccd')", "language": "python", "predicted_output": "[('a', 3), ('b', 3), ('c', 2), ('d', 1)]"}}
{"submissionId": "cmsvonedl028lg4p2bf7mr0rs", "title": "Submission 7MR0RS", "payload": {"code": "\ndef is_valid_parens(s):\n pairs = {')': '(', ']': '[', '}': '{'}\n stack = []\n for ch in s:\n if ch in '([{':\n stack.append(ch)\n elif ch in pairs:\n if not stack or stack.pop() != pairs[ch]:\n return False\n return not stack\n", "input": "is_valid_parens('{[()()]}')", "language": "python", "predicted_output": "true"}}
{"submissionId": "cmsvonedl028mg4p2ssmoqg4f", "title": "Submission MOQG4F", "payload": {"code": "\ndef min_path_sum(grid):\n rows = len(grid)\n cols = len(grid[0])\n dp = [[0] * cols for _ in range(rows)]\n dp[0][0] = grid[0][0]\n for j in range(1, cols):\n dp[0][j] = dp[0][j - 1] + grid[0][j]\n for i in range(1, rows):\n dp[i][0] = dp[i - 1][0] + grid[i][0]\n for i in range(1, rows):\n for j in range(1, cols):\n dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]) + grid[i][j]\n return dp[rows - 1][cols - 1]\n", "input": "min_path_sum([[1, 3, 1], [1, 5, 1], [4, 2, 1]])", "language": "python", "predicted_output": "7"}}
{"submissionId": "cmsvonedl028ng4p2au7gsl8z", "title": "Submission 7GSL8Z", "payload": {"code": "\ndef max_subarray_sum_circular(nums):\n total = sum(nums)\n cur_max = best_max = nums[0]\n cur_min = best_min = nums[0]\n for x in nums[1:]:\n cur_max = max(x, cur_max + x)\n best_max = max(best_max, cur_max)\n cur_min = min(x, cur_min + x)\n best_min = min(best_min, cur_min)\n if best_max < 0:\n return best_max\n return max(best_max, total - best_min)\n", "input": "max_subarray_sum_circular([5, -3, 5])", "language": "python", "predicted_output": "10"}}
{"submissionId": "cmsvonedl028og4p2yotr85al", "title": "Submission TR85AL", "payload": {"code": "\ndef flatten(nested):\n result = []\n for item in nested:\n if isinstance(item, list):\n result.extend(flatten(item))\n else:\n result.append(item)\n return result\n", "input": "flatten([1, [2, 3, [4, 5], 6], [7, [8]]])", "language": "python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7, 8]"}}
{"submissionId": "cmsvonedl028pg4p20yzfhdci", "title": "Submission ZFHDCI", "payload": {"code": "\ndef group_anagrams(words):\n groups = {}\n for w in words:\n key = ''.join(sorted(w))\n groups.setdefault(key, []).append(w)\n return sorted(groups.values(), key=lambda g: sorted(g))\n", "input": "group_anagrams(['eat', 'tea', 'tan', 'ate', 'nat', 'bat'])", "language": "python", "predicted_output": "[[\"eat\", \"tea\", \"ate\"], [\"bat\"], [\"tan\", \"nat\"]]"}}
{"submissionId": "cmsvowogv02c2g4p21pxxjsiv", "title": "Submission XXJSIV", "payload": {"code": "\ndef reorder_point(avg_daily_usage, lead_time_days, safety_stock):\n return avg_daily_usage * lead_time_days + safety_stock\n", "input": "reorder_point(42, 6, 75)", "language": "python", "predicted_output": "327"}}
{"submissionId": "cmsvowogv02c3g4p2kkcqfo64", "title": "Submission CQFO64", "payload": {"code": "\ndef monthly_payment(principal, annual_rate, months):\n r = annual_rate / 12\n if r == 0:\n return principal / months\n return principal * r * (1 + r) ** months / ((1 + r) ** months - 1)\n", "input": "round(monthly_payment(18500, 0.065, 48), 2)", "language": "python", "predicted_output": "438.73"}}
{"submissionId": "cmsvowogv02c4g4p2zgx4ltxr", "title": "Submission X4LTXR", "payload": {"code": "\ndef wind_chill(temp_f, wind_mph):\n if wind_mph <= 3 or temp_f > 50:\n return temp_f\n wc = 35.74 + 0.6215*temp_f - 35.75*(wind_mph**0.16) + 0.4275*temp_f*(wind_mph**0.16)\n return round(wc, 2)\n", "input": "wind_chill(20, 15)", "language": "python", "predicted_output": "6.22"}}
{"submissionId": "cmsvowogv02c5g4p2aywrh3sy", "title": "Submission WRH3SY", "payload": {"code": "\nimport re\ndef password_strength(pw):\n score = 0\n if len(pw) >= 8: score += 1\n if re.search(r'[A-Z]', pw): score += 1\n if re.search(r'[a-z]', pw): score += 1\n if re.search(r'[0-9]', pw): score += 1\n if re.search(r'[^A-Za-z0-9]', pw): score += 1\n labels = {0:'very weak',1:'weak',2:'weak',3:'medium',4:'strong',5:'very strong'}\n return labels[score]\n", "input": "password_strength('Tr0ub4dor&3')", "language": "python", "predicted_output": "very strong"}}
{"submissionId": "cmsvowogw02c6g4p2tzczx8ly", "title": "Submission CZX8LY", "payload": {"code": "\ndef transpose(m):\n return [list(row) for row in zip(*m)]\n", "input": "transpose([[1,2,3],[4,5,6]])", "language": "python", "predicted_output": "[[1, 4], [2, 5], [3, 6]]"}}
{"submissionId": "cmsvowogw02c7g4p2skrkqlbb", "title": "Submission RKQLBB", "payload": {"code": "\ndef total_with_tax(subtotal):\n if subtotal <= 100:\n rate = 0.05\n elif subtotal <= 500:\n rate = 0.07\n else:\n rate = 0.0825\n return round(subtotal * (1 + rate), 2)\n", "input": "total_with_tax(632.40)", "language": "python", "predicted_output": "684.57"}}
{"submissionId": "cmsvowogw02c8g4p22a4rtkhy", "title": "Submission 4RTKHY", "payload": {"code": "\ndef apply_discounts(price, discounts):\n for d in discounts:\n price -= price * d\n return round(price, 2)\n", "input": "apply_discounts(250.0, [0.1, 0.15, 0.05])", "language": "python", "predicted_output": "181.69"}}
{"submissionId": "cmsvowogw02c9g4p2w91z7420", "title": "Submission 1Z7420", "payload": {"code": "\nfrom datetime import datetime, timedelta\ndef business_days_between(start_date, end_date):\n d1 = datetime.strptime(start_date, '%Y-%m-%d')\n d2 = datetime.strptime(end_date, '%Y-%m-%d')\n days = 0\n current = d1\n while current < d2:\n if current.weekday() < 5:\n days += 1\n current += timedelta(days=1)\n return days\n", "input": "business_days_between('2026-08-01', '2026-08-15')", "language": "python", "predicted_output": "10"}}
{"submissionId": "cmsvowogw02cag4p2vjzn6jya", "title": "Submission ZN6JYA", "payload": {"code": "\ndef max_window_sum(nums, k):\n window = sum(nums[:k])\n best = window\n for i in range(k, len(nums)):\n window += nums[i] - nums[i-k]\n best = max(best, window)\n return best\n", "input": "max_window_sum([4,-1,3,7,-2,5,9,-8,2], 3)", "language": "python", "predicted_output": "12"}}
{"submissionId": "cmsvowogw02cbg4p2esf34a77", "title": "Submission F34A77", "payload": {"code": "\ndef roman_to_int(s):\n vals = {'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}\n total = 0\n for i, ch in enumerate(s):\n v = vals[ch]\n if i+1 < len(s) and vals[s[i+1]] > v:\n total -= v\n else:\n total += v\n return total\n", "input": "roman_to_int('MCMXCIV')", "language": "python", "predicted_output": "1994"}}
{"submissionId": "cmsvowogw02ccg4p23pbeo5qm", "title": "Submission BEO5QM", "payload": {"code": "\ndef is_valid(s):\n pairs = {')':'(', ']':'[', '}':'{'}\n stack = []\n for ch in s:\n if ch in '([{':\n stack.append(ch)\n elif ch in pairs:\n if not stack or stack.pop() != pairs[ch]:\n return False\n return not stack\n", "input": "is_valid('{[()()]}[]')", "language": "python", "predicted_output": "True"}}
{"submissionId": "cmsvowogw02cdg4p2k2x8o3gi", "title": "Submission X8O3GI", "payload": {"code": "\ndef sum_numeric_column(csv_text, col_index):\n rows = [r.split(',') for r in csv_text.strip().split('\\n')]\n return sum(float(r[col_index]) for r in rows)\n", "input": "sum_numeric_column('a,10,x\\nb,20,y\\nc,30,z', 1)", "language": "python", "predicted_output": "60.0"}}
{"submissionId": "cmsvowogw02ceg4p2lkkhyk13", "title": "Submission KHYK13", "payload": {"code": "\ndef most_common_word(text):\n words = text.lower().split()\n freq = {}\n for w in words:\n w = w.strip('.,!?')\n freq[w] = freq.get(w, 0) + 1\n return max(freq.items(), key=lambda x: x[1])[0]\n", "input": "most_common_word('the quick fox jumps over the lazy dog the fox runs')", "language": "python", "predicted_output": "the"}}
{"submissionId": "cmsvowogw02cfg4p2iztbuf45", "title": "Submission TBUF45", "payload": {"code": "\ndef levenshtein(a, b):\n m, n = len(a), len(b)\n dp = [[0]*(n+1) for _ in range(m+1)]\n for i in range(m+1): dp[i][0] = i\n for j in range(n+1): dp[0][j] = j\n for i in range(1, m+1):\n for j in range(1, n+1):\n cost = 0 if a[i-1]==b[j-1] else 1\n dp[i][j] = min(dp[i-1][j]+1, dp[i][j-1]+1, dp[i-1][j-1]+cost)\n return dp[m][n]\n", "input": "levenshtein('kitten', 'sitting')", "language": "python", "predicted_output": "3"}}
{"submissionId": "cmsvowogw02cgg4p23z8i6bd6", "title": "Submission 8I6BD6", "payload": {"code": "\ndef shipping_cost(weight_kg, distance_km):\n base = 5.0\n weight_cost = weight_kg * 0.8\n distance_cost = distance_km * 0.05\n if weight_kg > 20:\n distance_cost *= 1.15\n return round(base + weight_cost + distance_cost, 2)\n", "input": "shipping_cost(25, 340)", "language": "python", "predicted_output": "44.55"}}
{"submissionId": "cmsvowogw02chg4p2annz4uks", "title": "Submission NZ4UKS", "payload": {"code": "\ndef caesar_encode(text, shift):\n result = []\n for ch in text:\n if ch.isupper():\n result.append(chr((ord(ch)-65+shift)%26+65))\n elif ch.islower():\n result.append(chr((ord(ch)-97+shift)%26+97))\n else:\n result.append(ch)\n return ''.join(result)\n", "input": "caesar_encode('Attack at Dawn!', 7)", "language": "python", "predicted_output": "Haahjr ha Khdu!"}}
{"submissionId": "cmsvowogw02cig4p2t4qzqdc7", "title": "Submission QZQDC7", "payload": {"code": "\ndef flatten(d, parent_key=''):\n items = {}\n for k, v in d.items():\n new_key = f'{parent_key}.{k}' if parent_key else k\n if isinstance(v, dict):\n items.update(flatten(v, new_key))\n else:\n items[new_key] = v\n return items\n", "input": "flatten({'user': {'name': 'Alice', 'address': {'city': 'Reno', 'zip': '89501'}}, 'active': True})", "language": "python", "predicted_output": "{'user.name': 'Alice', 'user.address.city': 'Reno', 'user.address.zip': '89501', 'active': True}"}}
{"submissionId": "cmsvowogw02cjg4p2q2povkda", "title": "Submission POVKDA", "payload": {"code": "\ndef convert_hour(hour, from_offset, to_offset):\n diff = to_offset - from_offset\n return (hour + diff) % 24\n", "input": "convert_hour(14, -5, 9)", "language": "python", "predicted_output": "4"}}
{"submissionId": "cmsvowogw02ckg4p2k5a4r8wd", "title": "Submission A4R8WD", "payload": {"code": "\ndef bmi_category(weight_kg, height_m):\n bmi = weight_kg / (height_m ** 2)\n if bmi < 18.5:\n cat = 'underweight'\n elif bmi < 25:\n cat = 'normal'\n elif bmi < 30:\n cat = 'overweight'\n else:\n cat = 'obese'\n return f'{round(bmi,1)}:{cat}'\n", "input": "bmi_category(82, 1.78)", "language": "python", "predicted_output": "25.9:overweight"}}
{"submissionId": "cmsvowogw02clg4p232dj6h72", "title": "Submission DJ6H72", "payload": {"code": "\ndef compound_interest(principal, rate, times_per_year, years):\n amount = principal * (1 + rate/times_per_year) ** (times_per_year*years)\n return round(amount, 2)\n", "input": "compound_interest(5000, 0.045, 12, 10)", "language": "python", "predicted_output": "7834.96"}}
{"submissionId": "cmsvowogw02cmg4p2t1fqlzys", "title": "Submission FQLZYS", "payload": {"code": "\ndef reverse_in_groups(lst, k):\n result = []\n for i in range(0, len(lst), k):\n chunk = lst[i:i+k]\n result.extend(chunk[::-1])\n return result\n", "input": "reverse_in_groups([1,2,3,4,5,6,7,8,9,10], 3)", "language": "python", "predicted_output": "[3, 2, 1, 6, 5, 4, 9, 8, 7, 10]"}}
{"submissionId": "cmsvowogw02cng4p2ndltosnq", "title": "Submission LTOSNQ", "payload": {"code": "\ndef eval_postfix(expr):\n stack = []\n for tok in expr.split():\n if tok in '+-*/':\n b = stack.pop()\n a = stack.pop()\n if tok == '+': stack.append(a+b)\n elif tok == '-': stack.append(a-b)\n elif tok == '*': stack.append(a*b)\n elif tok == '/': stack.append(a/b)\n else:\n stack.append(float(tok))\n return stack[0]\n", "input": "eval_postfix('4 6 2 * + 3 -')", "language": "python", "predicted_output": "13.0"}}
{"submissionId": "cmsvowogw02cog4p2oco061i2", "title": "Submission O061I2", "payload": {"code": "\ndef compute_gpa(grades_credits):\n total_points = sum(g*c for g, c in grades_credits)\n total_credits = sum(c for _, c in grades_credits)\n return round(total_points / total_credits, 2)\n", "input": "compute_gpa([(4.0,3),(3.7,4),(3.3,3),(4.0,2)])", "language": "python", "predicted_output": "3.73"}}
{"submissionId": "cmsvowogw02cpg4p28r5wyvke", "title": "Submission 5WYVKE", "payload": {"code": "\nimport re\ndef is_palindrome(s):\n cleaned = re.sub(r'[^a-z0-9]', '', s.lower())\n return cleaned == cleaned[::-1]\n", "input": "is_palindrome('A man, a plan, a canal: Panama')", "language": "python", "predicted_output": "True"}}
{"submissionId": "cmsvowogw02cqg4p29vd9dxeo", "title": "Submission D9DXEO", "payload": {"code": "\ndef merge_sorted(a, b):\n result = []\n i = j = 0\n while i < len(a) and j < len(b):\n if a[i] <= b[j]:\n result.append(a[i]); i += 1\n else:\n result.append(b[j]); j += 1\n result.extend(a[i:])\n result.extend(b[j:])\n return result\n", "input": "merge_sorted([1,4,7,10,15], [2,3,8,9,20])", "language": "python", "predicted_output": "[1, 2, 3, 4, 7, 8, 9, 10, 15, 20]"}}
{"submissionId": "cmsvowogw02crg4p2gk56wuq2", "title": "Submission 56WUQ2", "payload": {"code": "\ndef digital_root(n):\n while n >= 10:\n n = sum(int(d) for d in str(n))\n return n\n", "input": "digital_root(9875)", "language": "Python", "predicted_output": "2"}}
{"submissionId": "cmsvowogw02csg4p246t1dhbd", "title": "Submission T1DHBD", "payload": {"code": "\ndef lcs_length(a, b):\n m, n = len(a), len(b)\n dp = [[0] * (n + 1) for _ in range(m + 1)]\n for i in range(1, m + 1):\n for j in range(1, n + 1):\n if a[i - 1] == b[j - 1]:\n dp[i][j] = dp[i - 1][j - 1] + 1\n else:\n dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])\n return dp[m][n]\n", "input": "lcs_length('ABCBDAB', 'BDCABA')", "language": "Python", "predicted_output": "4"}}
{"submissionId": "cmsvowogw02ctg4p213fs8p2i", "title": "Submission FS8P2I", "payload": {"code": "\ndef rotate_ccw(matrix):\n n = len(matrix)\n m = len(matrix[0])\n return [[matrix[r][c] for r in range(n)] for c in range(m - 1, -1, -1)]\n", "input": "rotate_ccw([[1, 2, 3], [4, 5, 6]])", "language": "Python", "predicted_output": "[[3, 6], [2, 5], [1, 4]]"}}
{"submissionId": "cmsvowogw02cug4p2j4xqi1lk", "title": "Submission XQI1LK", "payload": {"code": "\ndef sort_colors(nums):\n low, mid, high = 0, 0, len(nums) - 1\n nums = list(nums)\n while mid <= high:\n if nums[mid] == 0:\n nums[low], nums[mid] = nums[mid], nums[low]\n low += 1\n mid += 1\n elif nums[mid] == 1:\n mid += 1\n else:\n nums[mid], nums[high] = nums[high], nums[mid]\n high -= 1\n return nums\n", "input": "sort_colors([2, 0, 2, 1, 1, 0])", "language": "Python", "predicted_output": "[0, 0, 1, 1, 2, 2]"}}
{"submissionId": "cmsvowogw02cvg4p2c0rt43ua", "title": "Submission RT43UA", "payload": {"code": "\nimport cmath\ndef solve_quadratic(a, b, c):\n disc = b**2 - 4*a*c\n root1 = (-b + cmath.sqrt(disc)) / (2*a)\n root2 = (-b - cmath.sqrt(disc)) / (2*a)\n return (round(root1.real,3), round(root2.real,3)) if disc >= 0 else (str(root1), str(root2))\n", "input": "solve_quadratic(2, -7, 3)", "language": "python", "predicted_output": "(3.0, 0.5)"}}
{"submissionId": "cmsvq95rh02oug4p2yn7n6i78", "title": "Submission 7N6I78", "payload": {"code": "\ndef zellers_congruence(year, month, day):\n if month < 3:\n month += 12\n year -= 1\n k = year % 100\n j = year // 100\n h = (day + (13 * (month + 1)) // 5 + k + k // 4 + j // 4 + 5 * j) % 7\n days = [\"Saturday\", \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\"]\n return days[h]\n", "input": "zellers_congruence(2026, 8, 16)", "language": "Python", "predicted_output": "Sunday"}}
{"submissionId": "cmsvq95rh02ovg4p2euuwncy8", "title": "Submission UWNCY8", "payload": {"code": "\ndef gregorian_to_jdn(year, month, day):\n a = (14 - month) // 12\n y = year + 4800 - a\n m = month + 12 * a - 3\n jdn = day + (153 * m + 2) // 5 + 365 * y + y // 4 - y // 100 + y // 400 - 32045\n return jdn\n", "input": "gregorian_to_jdn(2000, 1, 1)", "language": "Python", "predicted_output": "2451545"}}
{"submissionId": "cmsvq95rh02owg4p2pvmky86e", "title": "Submission MKY86E", "payload": {"code": "\ndef crc8(data: bytes, poly=0x07):\n crc = 0\n for byte in data:\n crc ^= byte\n for _ in range(8):\n if crc & 0x80:\n crc = ((crc << 1) ^ poly) & 0xFF\n else:\n crc = (crc << 1) & 0xFF\n return crc\n", "input": "crc8(b'123456789')", "language": "Python", "predicted_output": "244"}}
{"submissionId": "cmsvq95rh02oxg4p2vlfv49vm", "title": "Submission FV49VM", "payload": {"code": "\ndef luhn_checksum(card_number: str):\n digits = [int(d) for d in card_number]\n odd_digits = digits[-1::-2]\n even_digits = digits[-2::-2]\n total = sum(odd_digits)\n for d in even_digits:\n total += sum(divmod(d * 2, 10))\n return total % 10 == 0\n", "input": "luhn_checksum('4532015112830366')", "language": "Python", "predicted_output": "True"}}
{"submissionId": "cmsvq95rh02oyg4p2p567fdee", "title": "Submission 67FDEE", "payload": {"code": "\ndef collatz_length(n):\n steps = 0\n while n != 1:\n n = n // 2 if n % 2 == 0 else 3 * n + 1\n steps += 1\n return steps\n", "input": "collatz_length(27)", "language": "Python", "predicted_output": "111"}}
{"submissionId": "cmsvq95rh02ozg4p2qjjdp1ej", "title": "Submission JDP1EJ", "payload": {"code": "\ndef base62_encode(num):\n alphabet = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\n if num == 0:\n return alphabet[0]\n arr = []\n base = len(alphabet)\n while num:\n num, rem = divmod(num, base)\n arr.append(alphabet[rem])\n return \"\".join(reversed(arr))\n", "input": "base62_encode(123456789)", "language": "Python", "predicted_output": "8M0kX"}}
{"submissionId": "cmsvq95rh02p0g4p2bahv4hwd", "title": "Submission HV4HWD", "payload": {"code": "\ndef caesar_encrypt(text, shift):\n result = []\n for ch in text:\n if ch.isupper():\n result.append(chr((ord(ch) - 65 + shift) % 26 + 65))\n elif ch.islower():\n result.append(chr((ord(ch) - 97 + shift) % 26 + 97))\n else:\n result.append(ch)\n return \"\".join(result)\n", "input": "caesar_encrypt('Attack at Dawn!', 3)", "language": "Python", "predicted_output": "Dwwdfn dw Gdzq!"}}
{"submissionId": "cmsvq95rh02p1g4p2hegfgbt6", "title": "Submission GFGBT6", "payload": {"code": "\ndef vigenere_encrypt(text, key):\n result = []\n key = key.upper()\n ki = 0\n for ch in text:\n if ch.isalpha():\n shift = ord(key[ki % len(key)]) - 65\n base = 65 if ch.isupper() else 97\n result.append(chr((ord(ch) - base + shift) % 26 + base))\n ki += 1\n else:\n result.append(ch)\n return \"\".join(result)\n", "input": "vigenere_encrypt('ATTACKATDAWN', 'LEMON')", "language": "Python", "predicted_output": "LXFOPVEFRNHR"}}
{"submissionId": "cmsvq95rh02p2g4p23sfxgm50", "title": "Submission FXGM50", "payload": {"code": "\ndef weighted_average_drop_lowest(scores, weights):\n pairs = list(zip(scores, weights))\n pairs.sort(key=lambda p: p[0])\n dropped = pairs[1:]\n total_weight = sum(w for _, w in dropped)\n return round(sum(s*w for s, w in dropped) / total_weight, 2)\n", "input": "weighted_average_drop_lowest([88, 45, 92, 79], [0.3, 0.2, 0.25, 0.25])", "language": "Python", "predicted_output": "86.44"}}
{"submissionId": "cmsvq95rh02p3g4p2l49o2zdq", "title": "Submission 9O2ZDQ", "payload": {"code": "\ndef infix_to_postfix(expr):\n prec = {\"+\": 1, \"-\": 1, \"*\": 2, \"/\": 2}\n output = []\n ops = []\n tokens = expr.split()\n for tok in tokens:\n if tok.isdigit():\n output.append(tok)\n elif tok == \"(\":\n ops.append(tok)\n elif tok == \")\":\n while ops and ops[-1] != \"(\":\n output.append(ops.pop())\n ops.pop()\n else:\n while ops and ops[-1] != \"(\" and prec.get(ops[-1], 0) >= prec.get(tok, 0):\n output.append(ops.pop())\n ops.append(tok)\n while ops:\n output.append(ops.pop())\n return \" \".join(output)\n", "input": "infix_to_postfix('3 + 4 * ( 2 - 1 )')", "language": "Python", "predicted_output": "3 4 2 1 - * +"}}
{"submissionId": "cmsvq95rh02p4g4p23xvti296", "title": "Submission VTI296", "payload": {"code": "\ndef union_find_components(n, edges):\n parent = list(range(n))\n def find(x):\n while parent[x] != x:\n parent[x] = parent[parent[x]]\n x = parent[x]\n return x\n def union(a, b):\n ra, rb = find(a), find(b)\n if ra != rb:\n parent[ra] = rb\n for a, b in edges:\n union(a, b)\n return len(set(find(i) for i in range(n)))\n", "input": "union_find_components(5, [(0,1),(1,2),(3,4)])", "language": "Python", "predicted_output": "2"}}
{"submissionId": "cmsvq95rh02p5g4p25ibq3xpz", "title": "Submission BQ3XPZ", "payload": {"code": "\nclass TrieNode:\n def __init__(self):\n self.children = {}\n self.is_end = False\n\ndef trie_search_prefix(words, prefix):\n root = TrieNode()\n for w in words:\n node = root\n for ch in w:\n if ch not in node.children:\n node.children[ch] = TrieNode()\n node = node.children[ch]\n node.is_end = True\n node = root\n for ch in prefix:\n if ch not in node.children:\n return []\n node = node.children[ch]\n results = []\n def dfs(n, path):\n if n.is_end:\n results.append(prefix + path)\n for c, child in n.children.items():\n dfs(child, path + c)\n dfs(node, \"\")\n return sorted(results)\n", "input": "trie_search_prefix(['cat', 'car', 'cart', 'dog'], 'ca')", "language": "Python", "predicted_output": "['car', 'cart', 'cat']"}}
{"submissionId": "cmsvq95rh02p6g4p2z6fxe4sb", "title": "Submission FXE4SB", "payload": {"code": "\ndef topological_sort(n, edges):\n from collections import deque\n indeg = [0] * n\n graph = [[] for _ in range(n)]\n for u, v in edges:\n graph[u].append(v)\n indeg[v] += 1\n q = deque([i for i in range(n) if indeg[i] == 0])\n order = []\n while q:\n u = q.popleft()\n order.append(u)\n for v in graph[u]:\n indeg[v] -= 1\n if indeg[v] == 0:\n q.append(v)\n return order\n", "input": "topological_sort(6, [(5,2),(5,0),(4,0),(4,1),(2,3),(3,1)])", "language": "Python", "predicted_output": "[4, 5, 2, 0, 3, 1]"}}
{"submissionId": "cmsvq95rh02p7g4p2s3op3ytr", "title": "Submission OP3YTR", "payload": {"code": "\ndef dijkstra(n, edges, src):\n import heapq\n graph = [[] for _ in range(n)]\n for u, v, w in edges:\n graph[u].append((v, w))\n graph[v].append((u, w))\n dist = [float('inf')] * n\n dist[src] = 0\n pq = [(0, src)]\n while pq:\n d, u = heapq.heappop(pq)\n if d > dist[u]:\n continue\n for v, w in graph[u]:\n nd = d + w\n if nd < dist[v]:\n dist[v] = nd\n heapq.heappush(pq, (nd, v))\n return dist\n", "input": "dijkstra(5, [(0,1,4),(0,2,1),(2,1,2),(1,3,1),(2,3,5),(3,4,3)], 0)", "language": "Python", "predicted_output": "[0, 3, 1, 4, 7]"}}
{"submissionId": "cmsvq95rh02p8g4p2bocpvrmq", "title": "Submission CPVRMQ", "payload": {"code": "\ndef reservoir_sample_deterministic(stream, k, rand_sequence):\n reservoir = stream[:k]\n for i in range(k, len(stream)):\n j = rand_sequence[i - k] % (i + 1)\n if j < k:\n reservoir[j] = stream[i]\n return reservoir\n", "input": "reservoir_sample_deterministic([10,20,30,40,50,60], 3, [0,1,2])", "language": "Python", "predicted_output": "[40, 50, 60]"}}
{"submissionId": "cmsvq95ri02p9g4p253t1w1nv", "title": "Submission T1W1NV", "payload": {"code": "\ndef majority_element(nums):\n count = 0\n candidate = None\n for n in nums:\n if count == 0:\n candidate = n\n count += 1 if n == candidate else -1\n return candidate\n", "input": "majority_element([2,2,1,1,1,2,2])", "language": "Python", "predicted_output": "2"}}
{"submissionId": "cmsvq95ri02pag4p2mbvq3fro", "title": "Submission VQ3FRO", "payload": {"code": "\ndef max_subarray_with_indices(nums):\n best_sum = nums[0]\n cur_sum = nums[0]\n best_start = best_end = cur_start = 0\n for i in range(1, len(nums)):\n if cur_sum < 0:\n cur_sum = nums[i]\n cur_start = i\n else:\n cur_sum += nums[i]\n if cur_sum > best_sum:\n best_sum = cur_sum\n best_start = cur_start\n best_end = i\n return (best_sum, best_start, best_end)\n", "input": "max_subarray_with_indices([-2,1,-3,4,-1,2,1,-5,4])", "language": "Python", "predicted_output": "(6, 3, 6)"}}
{"submissionId": "cmsvq95ri02pbg4p2uffku3ir", "title": "Submission FKU3IR", "payload": {"code": "\ndef sieve_of_sundaram(limit):\n if limit < 2:\n return []\n n = (limit - 1) // 2\n marked = [False] * (n + 1)\n for i in range(1, n + 1):\n j = i\n while i + j + 2 * i * j <= n:\n marked[i + j + 2 * i * j] = True\n j += 1\n primes = [2] if limit >= 2 else []\n for i in range(1, n + 1):\n if not marked[i]:\n primes.append(2 * i + 1)\n return primes\n", "input": "sieve_of_sundaram(30)", "language": "Python", "predicted_output": "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]"}}
{"submissionId": "cmsvq95ri02pcg4p2hq4d1qkx", "title": "Submission 4D1QKX", "payload": {"code": "\ndef extended_gcd(a, b):\n if b == 0:\n return (a, 1, 0)\n g, x1, y1 = extended_gcd(b, a % b)\n x = y1\n y = x1 - (a // b) * y1\n return (g, x, y)\n", "input": "extended_gcd(240, 46)", "language": "Python", "predicted_output": "(2, -9, 47)"}}
{"submissionId": "cmsvq95ri02pdg4p2y3lg3s2l", "title": "Submission LG3S2L", "payload": {"code": "\ndef mod_pow(base, exp, mod):\n result = 1\n base = base % mod\n while exp > 0:\n if exp % 2 == 1:\n result = (result * base) % mod\n exp //= 2\n base = (base * base) % mod\n return result\n", "input": "mod_pow(4, 13, 497)", "language": "Python", "predicted_output": "445"}}
{"submissionId": "cmsvq95ri02peg4p2ehj5dmd5", "title": "Submission J5DMD5", "payload": {"code": "\ndef miller_rabin(n):\n if n < 2:\n return False\n for p in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]:\n if n % p == 0:\n return n == p\n d = n - 1\n r = 0\n while d % 2 == 0:\n d //= 2\n r += 1\n for a in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]:\n x = pow(a, d, n)\n if x == 1 or x == n - 1:\n continue\n for _ in range(r - 1):\n x = x * x % n\n if x == n - 1:\n break\n else:\n return False\n return True\n", "input": "miller_rabin(561)", "language": "Python", "predicted_output": "False"}}
{"submissionId": "cmsvq95ri02pfg4p2topd80c2", "title": "Submission PD80C2", "payload": {"code": "\ndef morse_encode(text):\n MORSE = {\n \"A\": \".-\", \"B\": \"-...\", \"C\": \"-.-.\", \"D\": \"-..\", \"E\": \".\",\n \"F\": \"..-.\", \"G\": \"--.\", \"H\": \"....\", \"I\": \"..\", \"J\": \".---\",\n \"K\": \"-.-\", \"L\": \".-..\", \"M\": \"--\", \"N\": \"-.\", \"O\": \"---\",\n \"P\": \".--.\", \"Q\": \"--.-\", \"R\": \".-.\", \"S\": \"...\", \"T\": \"-\",\n \"U\": \"..-\", \"V\": \"...-\", \"W\": \".--\", \"X\": \"-..-\", \"Y\": \"-.--\", \"Z\": \"--..\",\n \" \": \"/\"\n }\n return \" \".join(MORSE[ch] for ch in text.upper())\n", "input": "morse_encode('SOS')", "language": "Python", "predicted_output": "... --- ..."}}
{"submissionId": "cmsvq95ri02pgg4p2mttzsxd9", "title": "Submission TZSXD9", "payload": {"code": "\ndef bresenham_line(x0, y0, x1, y1):\n points = []\n dx = abs(x1 - x0)\n dy = abs(y1 - y0)\n sx = 1 if x0 < x1 else -1\n sy = 1 if y0 < y1 else -1\n err = dx - dy\n while True:\n points.append((x0, y0))\n if x0 == x1 and y0 == y1:\n break\n e2 = 2 * err\n if e2 > -dy:\n err -= dy\n x0 += sx\n if e2 < dx:\n err += dx\n y0 += sy\n return points\n", "input": "bresenham_line(0, 0, 5, 3)", "language": "Python", "predicted_output": "[(0, 0), (1, 1), (2, 1), (3, 2), (4, 2), (5, 3)]"}}
{"submissionId": "cmsvq95ri02phg4p2m21hhxsp", "title": "Submission 1HHXSP", "payload": {"code": "\nimport heapq\n\ndef huffman_code_lengths(freqs):\n heap = [[f, i, [ch]] for i, (ch, f) in enumerate(freqs.items())]\n heapq.heapify(heap)\n lengths = {ch: 0 for ch in freqs}\n counter = len(heap)\n while len(heap) > 1:\n f1, _, chars1 = heapq.heappop(heap)\n f2, _, chars2 = heapq.heappop(heap)\n for ch in chars1 + chars2:\n lengths[ch] += 1\n heapq.heappush(heap, [f1 + f2, counter, chars1 + chars2])\n counter += 1\n return dict(sorted(lengths.items()))\n", "input": "huffman_code_lengths({'a': 5, 'b': 9, 'c': 12, 'd': 13, 'e': 16, 'f': 45})", "language": "Python", "predicted_output": "{'a': 4, 'b': 4, 'c': 3, 'd': 3, 'e': 3, 'f': 1}"}}
{"submissionId": "cmsvq95ri02pig4p2bc7os007", "title": "Submission 7OS007", "payload": {"code": "\ndef rabin_karp_search(text, pattern):\n n, m = len(text), len(pattern)\n if m > n:\n return -1\n base, mod = 256, 1000000007\n h = pow(base, m - 1, mod)\n p_hash = t_hash = 0\n for i in range(m):\n p_hash = (p_hash * base + ord(pattern[i])) % mod\n t_hash = (t_hash * base + ord(text[i])) % mod\n for i in range(n - m + 1):\n if p_hash == t_hash and text[i:i+m] == pattern:\n return i\n if i < n - m:\n t_hash = ((t_hash - ord(text[i]) * h) * base + ord(text[i + m])) % mod\n return -1\n", "input": "rabin_karp_search('ABABDABACDABABCABAB', 'ABABCABAB')", "language": "Python", "predicted_output": "10"}}
{"submissionId": "cmsvq95ri02pjg4p28mlbt92o", "title": "Submission LBT92O", "payload": {"code": "\nimport datetime\n\ndef iso_week_date(year, month, day):\n d = datetime.date(year, month, day)\n iso_year, iso_week, iso_weekday = d.isocalendar()\n return (iso_year, iso_week, iso_weekday)\n", "input": "iso_week_date(2027, 1, 1)", "language": "Python", "predicted_output": "(2026, 53, 5)"}}
{"submissionId": "cmsvqtegb02scg4p2ga6e0cpi", "title": "Submission 6E0CPI", "payload": {"code": "\ndef kaprekar_steps(n):\n steps = 0\n seen = n\n while seen != 6174 and steps < 100:\n digits = f\"{seen:04d}\"\n asc = int(\"\".join(sorted(digits)))\n desc = int(\"\".join(sorted(digits, reverse=True)))\n seen = desc - asc\n steps += 1\n return steps\n", "input": "kaprekar_steps(3524)", "language": "Python", "predicted_output": "3"}}
{"submissionId": "cmsvte58z0000uvp2ph62id6s", "title": "Submission 62ID6S", "payload": {"code": "def running_median(values):\n import bisect\n sorted_vals = []\n medians = []\n for v in values:\n bisect.insort(sorted_vals, v)\n n = len(sorted_vals)\n if n % 2 == 1:\n medians.append(sorted_vals[n // 2])\n else:\n medians.append((sorted_vals[n // 2 - 1] + sorted_vals[n // 2]) / 2)\n return medians", "input": "running_median([5, 2, 8, 1, 9])", "language": "Python", "predicted_output": "[5, 3.5, 5, 3.5, 5]"}}
{"submissionId": "cmsvte58z0001uvp2iibbmckr", "title": "Submission BBMCKR", "payload": {"code": "def flatten_nested(items, depth=0):\n result = []\n for item in items:\n if isinstance(item, list) and depth < 2:\n result.extend(flatten_nested(item, depth + 1))\n else:\n result.append(item)\n return result", "input": "flatten_nested([1, [2, 3, [4, [5, 6]]], 7])", "language": "Python", "predicted_output": "[1, 2, 3, 4, [5, 6], 7]"}}
{"submissionId": "cmsvte58z0002uvp26r4dy0fl", "title": "Submission 4DY0FL", "payload": {"code": "class CircularBuffer:\n def __init__(self, size):\n self.size = size\n self.buf = []\n def push(self, val):\n self.buf.append(val)\n if len(self.buf) > self.size:\n self.buf.pop(0)\n def snapshot(self):\n return list(self.buf)\n\ndef drive(vals, size):\n cb = CircularBuffer(size)\n snaps = []\n for v in vals:\n cb.push(v)\n snaps.append(cb.snapshot())\n return snaps", "input": "drive([1,2,3,4,5], 3)", "language": "Python", "predicted_output": "[[1], [1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5]]"}}
{"submissionId": "cmsvte58z0003uvp2ra8h9zw3", "title": "Submission 8H9ZW3", "payload": {"code": "def safe_divide_chain(nums):\n results = []\n acc = nums[0]\n for n in nums[1:]:\n try:\n acc = acc / n\n except ZeroDivisionError:\n results.append('div0')\n acc = 0\n continue\n results.append(round(acc, 3))\n return results", "input": "safe_divide_chain([100, 2, 0, 5, 0])", "language": "Python", "predicted_output": "[50.0, 'div0', 0.0, 'div0']"}}
{"submissionId": "cmsvte58z0004uvp2iice54pt", "title": "Submission CE54PT", "payload": {"code": "def word_frequency_rank(text):\n from collections import Counter\n words = text.lower().split()\n counts = Counter(words)\n ranked = sorted(counts.items(), key=lambda kv: (-kv[1], kv[0]))\n return ranked[:3]", "input": "word_frequency_rank('the cat sat on the mat the cat ran')", "language": "Python", "predicted_output": "[('the', 3), ('cat', 2), ('mat', 1)]"}}
{"submissionId": "cmsvte58z0005uvp2bsdt7tiu", "title": "Submission DT7TIU", "payload": {"code": "def matrix_transpose_sum(matrix):\n rows = len(matrix)\n cols = len(matrix[0])\n transposed = [[matrix[r][c] for r in range(rows)] for c in range(cols)]\n row_sums = [sum(row) for row in transposed]\n return transposed, row_sums", "input": "matrix_transpose_sum([[1,2,3],[4,5,6]])", "language": "Python", "predicted_output": "([[1, 4], [2, 5], [3, 6]], [5, 7, 9])"}}
{"submissionId": "cmsvte58z0006uvp259dhxku9", "title": "Submission DHXKU9", "payload": {"code": "def retry_with_backoff(attempts, fail_until):\n log = []\n for i in range(1, attempts + 1):\n if i < fail_until:\n log.append(f'attempt {i}: failed')\n else:\n log.append(f'attempt {i}: success')\n break\n else:\n log.append('exhausted')\n return log", "input": "retry_with_backoff(5, 3)", "language": "Python", "predicted_output": "['attempt 1: failed', 'attempt 2: failed', 'attempt 3: success']"}}
{"submissionId": "cmsvte58z0007uvp2zj525tkh", "title": "Submission 525TKH", "payload": {"code": "def dedupe_preserve_order(items):\n seen = set()\n out = []\n for item in items:\n key = item if isinstance(item, (int, str)) else tuple(item)\n if key not in seen:\n seen.add(key)\n out.append(item)\n return out", "input": "dedupe_preserve_order([1, 2, 2, 3, 1, 4, 3])", "language": "Python", "predicted_output": "[1, 2, 3, 4]"}}
{"submissionId": "cmsvte58z0008uvp2t64v3orx", "title": "Submission 4V3ORX", "payload": {"code": "class Graph:\n def __init__(self):\n self.adj = {}\n def add_edge(self, a, b):\n self.adj.setdefault(a, []).append(b)\n self.adj.setdefault(b, []).append(a)\n def bfs(self, start):\n visited = [start]\n queue = [start]\n while queue:\n node = queue.pop(0)\n for neighbor in sorted(self.adj.get(node, [])):\n if neighbor not in visited:\n visited.append(neighbor)\n queue.append(neighbor)\n return visited\n\ndef build_and_bfs(edges, start):\n g = Graph()\n for a, b in edges:\n g.add_edge(a, b)\n return g.bfs(start)", "input": "build_and_bfs([(1,2),(1,3),(2,4),(3,4),(4,5)], 1)", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5]"}}
{"submissionId": "cmsvte58z0009uvp2o0qoxh1y", "title": "Submission QOXH1Y", "payload": {"code": "def parse_csv_row_types(row):\n result = []\n for cell in row.split(','):\n cell = cell.strip()\n try:\n result.append(int(cell))\n except ValueError:\n try:\n result.append(float(cell))\n except ValueError:\n if cell.lower() in ('true', 'false'):\n result.append(cell.lower() == 'true')\n else:\n result.append(cell)\n return result", "input": "parse_csv_row_types('42, 3.14, true, hello, false')", "language": "Python", "predicted_output": "[42, 3.14, True, 'hello', False]"}}
{"submissionId": "cmsvte58z000auvp2ytl3q4vb", "title": "Submission L3Q4VB", "payload": {"code": "def sliding_window_max(nums, k):\n from collections import deque\n dq = deque()\n result = []\n for i, n in enumerate(nums):\n while dq and nums[dq[-1]] <= n:\n dq.pop()\n dq.append(i)\n if dq[0] <= i - k:\n dq.popleft()\n if i >= k - 1:\n result.append(nums[dq[0]])\n return result", "input": "sliding_window_max([1,3,-1,-3,5,3,6,7], 3)", "language": "Python", "predicted_output": "[3, 3, 5, 5, 6, 7]"}}
{"submissionId": "cmsvte58z000buvp2dxwtcafd", "title": "Submission WTCAFD", "payload": {"code": "def merge_intervals(intervals):\n intervals = sorted(intervals, key=lambda x: x[0])\n merged = [intervals[0]]\n for start, end in intervals[1:]:\n last = merged[-1]\n if start <= last[1]:\n merged[-1] = (last[0], max(last[1], end))\n else:\n merged.append((start, end))\n return merged", "input": "merge_intervals([(1,3),(2,6),(8,10),(15,18),(9,12)])", "language": "Python", "predicted_output": "[(1, 6), (8, 12), (15, 18)]"}}
{"submissionId": "cmsvte58z000cuvp2vwvnlsez", "title": "Submission VNLSEZ", "payload": {"code": "def exception_chain(vals):\n out = []\n for v in vals:\n try:\n if v < 0:\n raise ValueError('negative')\n if v == 0:\n raise ZeroDivisionError('zero')\n out.append(100 / v)\n except (ValueError, ZeroDivisionError) as e:\n out.append(str(e))\n finally:\n out.append('checked')\n return out", "input": "exception_chain([5, -1, 0, 4])", "language": "Python", "predicted_output": "[20.0, 'checked', 'negative', 'checked', 'zero', 'checked', 25.0, 'checked']"}}
{"submissionId": "cmsvte58z000duvp27buqyehf", "title": "Submission UQYEHF", "payload": {"code": "def state_machine(events):\n state = 'idle'\n transitions = {\n ('idle', 'start'): 'running',\n ('running', 'pause'): 'paused',\n ('paused', 'resume'): 'running',\n ('running', 'stop'): 'idle',\n ('paused', 'stop'): 'idle',\n }\n history = [state]\n for e in events:\n state = transitions.get((state, e), state)\n history.append(state)\n return history", "input": "state_machine(['start', 'pause', 'resume', 'stop', 'start'])", "language": "Python", "predicted_output": "['idle', 'running', 'paused', 'running', 'idle', 'running']"}}
{"submissionId": "cmsvte58z000euvp24fpfsuuc", "title": "Submission PFSUUC", "payload": {"code": "def group_anagrams(words):\n groups = {}\n for w in words:\n key = ''.join(sorted(w))\n groups.setdefault(key, []).append(w)\n return sorted(groups.values(), key=lambda g: (-len(g), g[0]))", "input": "group_anagrams(['eat','tea','tan','ate','nat','bat'])", "language": "Python", "predicted_output": "[['eat', 'tea', 'ate'], ['tan', 'nat'], ['bat']]"}}
{"submissionId": "cmsvte58z000fuvp2gd1yzt3n", "title": "Submission 1YZT3N", "payload": {"code": "def lru_cache_sim(capacity, ops):\n from collections import OrderedDict\n cache = OrderedDict()\n results = []\n for op in ops:\n if op[0] == 'put':\n k, v = op[1], op[2]\n if k in cache:\n cache.move_to_end(k)\n cache[k] = v\n if len(cache) > capacity:\n cache.popitem(last=False)\n results.append(None)\n else:\n k = op[1]\n if k in cache:\n cache.move_to_end(k)\n results.append(cache[k])\n else:\n results.append(-1)\n return results", "input": "lru_cache_sim(2, [('put',1,1),('put',2,2),('get',1),('put',3,3),('get',2),('get',3)])", "language": "Python", "predicted_output": "[None, None, 1, None, -1, 3]"}}
{"submissionId": "cmsvte58z000guvp224esun4x", "title": "Submission ESUN4X", "payload": {"code": "def bit_manipulation_stats(n):\n binary = bin(n)[2:]\n ones = binary.count('1')\n zeros = binary.count('0')\n reversed_val = int(binary[::-1], 2)\n return {'binary': binary, 'ones': ones, 'zeros': zeros, 'reversed': reversed_val}", "input": "bit_manipulation_stats(43)", "language": "Python", "predicted_output": "{'binary': '101011', 'ones': 4, 'zeros': 2, 'reversed': 53}"}}
{"submissionId": "cmsvte58z000huvp289ttatv2", "title": "Submission TTATV2", "payload": {"code": "def recursive_fib_memo(n, memo=None):\n if memo is None:\n memo = {}\n if n in memo:\n return memo[n]\n if n <= 1:\n return n\n memo[n] = recursive_fib_memo(n-1, memo) + recursive_fib_memo(n-2, memo)\n return memo[n]\n\ndef fib_sequence(n):\n return [recursive_fib_memo(i) for i in range(n)]", "input": "fib_sequence(12)", "language": "Python", "predicted_output": "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]"}}
{"submissionId": "cmsvte58z000iuvp2w0l3s15j", "title": "Submission L3S15J", "payload": {"code": "def validate_and_normalize_paths(paths):\n import posixpath\n normalized = []\n for p in paths:\n try:\n norm = posixpath.normpath(p)\n if norm.startswith('..'):\n raise ValueError('escapes root')\n normalized.append(norm)\n except ValueError as e:\n normalized.append(f'invalid: {e}')\n return normalized", "input": "validate_and_normalize_paths(['/a/b/../c', '../etc/passwd', './x/./y/', 'a//b///c'])", "language": "Python", "predicted_output": "['/a/c', 'invalid: escapes root', 'x/y', 'a/b/c']"}}
{"submissionId": "cmsvte58z000juvp2dcqkmrgw", "title": "Submission QKMRGW", "payload": {"code": "def custom_sort_with_key_errors(records):\n def key_fn(r):\n try:\n return (-r['priority'], r['name'])\n except KeyError:\n return (0, '')\n valid = [r for r in records if 'priority' in r and 'name' in r]\n return sorted(valid, key=key_fn)", "input": "custom_sort_with_key_errors([{'name':'b','priority':2},{'name':'a','priority':2},{'name':'c'},{'name':'d','priority':5}])", "language": "Python", "predicted_output": "[{'name': 'd', 'priority': 5}, {'name': 'a', 'priority': 2}, {'name': 'b', 'priority': 2}]"}}
{"submissionId": "cmsw2qs96003huvp2g020j92y", "title": "Submission 20J92Y", "payload": {"code": "class LazyTag:\n def __init__(self, label):\n self.label = label\n\n def __get__(self, obj, owner=None):\n if obj is None:\n return \"class-access\"\n return (\"nondata\", self.label)\n\n\nclass Doubling:\n def __set_name__(self, owner, name):\n self.slot = name\n\n def __get__(self, obj, owner=None):\n if obj is None:\n return \"class-access\"\n return (\"data\", obj.__dict__.get(self.slot, \"unset\"))\n\n def __set__(self, obj, value):\n obj.__dict__[self.slot] = value * 2\n\n\nclass Node:\n lazy = LazyTag(\"lazy\")\n weight = Doubling()\n\n\ndef descriptor_probe():\n n = Node()\n first = n.lazy\n n.__dict__[\"lazy\"] = \"shadow\"\n second = n.lazy\n third = n.weight\n n.weight = 5\n fourth = n.weight\n fifth = n.__dict__[\"weight\"]\n n.__dict__[\"weight\"] = 99\n sixth = n.weight\n return (first, second, third, fourth, fifth, sixth, sorted(n.__dict__))", "input": "descriptor_probe()", "language": "Python", "predicted_output": "(('nondata', 'lazy'), 'shadow', ('data', 'unset'), ('data', 10), 10, ('data', 99), ['lazy', 'weight'])"}}
{"submissionId": "cmsw2qs96003iuvp2xlo3s736", "title": "Submission O3S736", "payload": {"code": "EVENTS = []\n\n\nclass Marker:\n def __set_name__(self, owner, name):\n EVENTS.append((\"set_name\", owner.__name__, name))\n\n\nclass Base:\n def __init_subclass__(cls, tag=\"none\", **kwargs):\n super().__init_subclass__(**kwargs)\n EVENTS.append((\"init_subclass\", cls.__name__, tag))\n cls.tag = tag\n\n\nclass Child(Base, tag=\"alpha\"):\n a = Marker()\n b = Marker()\n\n\nclass Grand(Child):\n c = Marker()\n\n\ndef class_creation_events():\n return (\n list(EVENTS),\n Child.tag,\n Grand.tag,\n \"tag\" in Grand.__dict__,\n \"tag\" in Base.__dict__,\n )", "input": "class_creation_events()", "language": "Python", "predicted_output": "([('set_name', 'Child', 'a'), ('set_name', 'Child', 'b'), ('init_subclass', 'Child', 'alpha'), ('set_name', 'Grand', 'c'), ('init_subclass', 'Grand', 'none')], 'alpha', 'none', True, False)"}}
{"submissionId": "cmsw2qs96003juvp2rmjt85pf", "title": "Submission JT85PF", "payload": {"code": "def inner():\n try:\n received = yield \"a\"\n yield (\"echo\", received)\n except ValueError as exc:\n yield (\"caught\", exc.args[0])\n return \"fin\"\n\n\ndef outer(log):\n delivered = yield from inner()\n log.append(delivered)\n yield \"tail\"\n\n\ndef delegate_run():\n log = []\n gen = outer(log)\n s1 = next(gen)\n s2 = gen.send(7)\n s3 = gen.throw(ValueError(\"bad\"))\n s4 = next(gen)\n\n other = []\n gen2 = outer(other)\n next(gen2)\n gen2.close()\n try:\n next(gen2)\n after = \"ran\"\n except StopIteration:\n after = \"stopped\"\n return (s1, s2, s3, s4, log, other, after)", "input": "delegate_run()", "language": "Python", "predicted_output": "('a', ('echo', 7), ('caught', 'bad'), 'tail', ['fin'], [], 'stopped')"}}
{"submissionId": "cmsw2qs96003kuvp2ncb5d6qj", "title": "Submission B5D6QJ", "payload": {"code": "class Fallback(dict):\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.misses = []\n\n def __missing__(self, key):\n self.misses.append(key)\n value = \"gen-\" + key\n self[key] = value\n return value\n\n\ndef missing_run():\n d = Fallback(a=\"A\")\n r1 = d[\"a\"]\n r2 = d[\"b\"]\n r3 = d.get(\"c\", \"default\")\n r4 = \"c\" in d\n r5 = d.setdefault(\"d\", \"D\")\n r6 = d.pop(\"zz\", \"nope\")\n return (r1, r2, r3, r4, r5, r6, d.misses, sorted(d.items()))", "input": "missing_run()", "language": "Python", "predicted_output": "('A', 'gen-b', 'default', False, 'D', 'nope', ['b'], [('a', 'A'), ('b', 'gen-b'), ('d', 'D')])"}}
{"submissionId": "cmsw2qs96003luvp2esnnw0rg", "title": "Submission NNW0RG", "payload": {"code": "class Temp:\n def __init__(self, celsius):\n self.celsius = celsius\n\n def __format__(self, spec):\n if spec.endswith(\"F\"):\n return format(self.celsius * 9 / 5 + 32, spec[:-1]) + \"F\"\n if not spec:\n return \"T(\" + str(self.celsius) + \")\"\n return format(self.celsius, spec)\n\n def __repr__(self):\n return \"Temp(%r)\" % (self.celsius,)\n\n def __str__(self):\n return \"temp:\" + str(self.celsius)\n\n\ndef format_run():\n t = Temp(21.5)\n return (\n format(t),\n format(t, \".1fF\"),\n \"{:>10.2f}|\".format(t),\n \"{0!r} {0!s} {0}\".format(t),\n \"{:*^12.3f}\".format(t),\n \"{:{w}.{p}f}\".format(t, w=9, p=3),\n f\"{t:.0fF}\",\n \"%s|%r\" % (t, t),\n )", "input": "format_run()", "language": "Python", "predicted_output": "('T(21.5)', '70.7F', ' 21.50|', 'Temp(21.5) temp:21.5 T(21.5)', '***21.500***', ' 21.500', '71F', 'temp:21.5|Temp(21.5)')"}}
{"submissionId": "cmsw2qs96003muvp2bkj6f8gf", "title": "Submission J6F8GF", "payload": {"code": "from collections import ChainMap\n\n\ndef layered_config():\n defaults = {\"color\": \"red\", \"size\": \"M\", \"qty\": 1}\n session = {\"size\": \"L\"}\n cm = ChainMap(session, defaults)\n a = (cm[\"size\"], cm[\"color\"], len(cm))\n cm[\"color\"] = \"blue\"\n b = (defaults[\"color\"], sorted(session.items()))\n del cm[\"color\"]\n c = (cm[\"color\"], \"color\" in session)\n child = cm.new_child({\"qty\": 9})\n d = (child[\"qty\"], len(child.maps), len(cm.maps))\n e = list(child.parents.maps) == list(cm.maps)\n session[\"qty\"] = 5\n f = (cm[\"qty\"], child[\"qty\"], sorted(cm.keys()))\n g = dict(ChainMap({\"a\": 1}, {\"a\": 2, \"b\": 3}))\n return (a, b, c, d, e, f, g)", "input": "layered_config()", "language": "Python", "predicted_output": "(('L', 'red', 3), ('red', [('color', 'blue'), ('size', 'L')]), ('red', False), (9, 3, 2), True, (5, 9, ['color', 'qty', 'size']), {'a': 1, 'b': 3})"}}
{"submissionId": "cmsw2qs96003nuvp2c8tfi5xl", "title": "Submission TFI5XL", "payload": {"code": "from collections import deque\n\n\ndef ring_buffer_run():\n d = deque([1, 2, 3], maxlen=4)\n d.append(4)\n d.append(5)\n a = list(d)\n d.appendleft(0)\n b = list(d)\n d.rotate(-1)\n c = list(d)\n\n e = deque(maxlen=3)\n e.extendleft([1, 2, 3, 4])\n f = list(e)\n\n g = deque(\"abc\")\n g.rotate(2)\n h = \"\".join(g)\n\n return (\n a,\n b,\n c,\n f,\n h,\n deque([1, 2, 3]).maxlen,\n list(deque([1, 2, 3, 4, 5], maxlen=2)),\n deque([1, 2, 3]) == deque([1, 2, 3]),\n list(deque([1, 2, 3]) + deque([4])),\n d.count(3),\n list(reversed(d)),\n )", "input": "ring_buffer_run()", "language": "Python", "predicted_output": "([2, 3, 4, 5], [0, 2, 3, 4], [2, 3, 4, 0], [4, 3, 2], 'bca', None, [4, 5], True, [1, 2, 3, 4], 1, [0, 4, 3, 2])"}}
{"submissionId": "cmsw2qs96003ouvp2jib841qb", "title": "Submission B841QB", "payload": {"code": "def buffer_share():\n buf = bytearray(b\"abcdef\")\n mv = memoryview(buf)\n a = (mv[0], bytes(mv[1:3]), mv.nbytes, mv.readonly)\n mv[2:4] = b\"ZZ\"\n b = bytes(buf)\n\n rows = memoryview(bytes(range(6))).cast(\"B\", shape=(2, 3))\n c = (rows.shape, rows.ndim, rows.tolist(), rows.tolist()[1][2])\n\n ro = memoryview(b\"xyz\")\n try:\n ro[0] = 65\n d = \"mutated\"\n except TypeError:\n d = \"TypeError\"\n\n e = memoryview(b\"abc\") == b\"abc\"\n\n stride = mv[::2]\n f = (stride.tolist(), stride.contiguous)\n\n try:\n buf.append(7)\n g = \"resized\"\n except BufferError:\n g = \"BufferError\"\n\n stride.release()\n mv.release()\n buf.append(7)\n return (a, b, c, d, e, f, g, bytes(buf))", "input": "buffer_share()", "language": "Python", "predicted_output": "((97, b'bc', 6, False), b'abZZef', ((2, 3), 2, [[0, 1, 2], [3, 4, 5]], 5), 'TypeError', True, ([97, 90, 101], False), 'BufferError', b'abZZef\\x07')"}}
{"submissionId": "cmsw2qs96003puvp2tbwd45mb", "title": "Submission WD45MB", "payload": {"code": "class Point:\n __match_args__ = (\"x\", \"y\")\n\n def __init__(self, x, y):\n self.x = x\n self.y = y\n\n\ndef classify(value):\n match value:\n case Point(0, 0):\n return \"origin\"\n case Point(x, 0) | Point(0, x):\n return (\"axis\", x)\n case Point(x=a, y=b) if a == b:\n return (\"diagonal\", a)\n case str() as s:\n return (\"string\", len(s))\n case [1, *rest]:\n return (\"starts-one\", rest)\n case {\"k\": v, **extra}:\n return (\"mapping\", v, sorted(extra))\n case (int() | float()) as n if n < 0:\n return (\"negative\", n)\n case _:\n return \"other\"\n\n\ndef classify_all():\n samples = [\n Point(0, 0),\n Point(3, 0),\n Point(0, 4),\n Point(2, 2),\n \"abc\",\n [1, 2, 3],\n (1, 9),\n {\"k\": 5, \"z\": 6},\n -2.5,\n 7,\n b\"\\x01\\x02\",\n ]\n return tuple(classify(v) for v in samples)", "input": "classify_all()", "language": "Python", "predicted_output": "('origin', ('axis', 3), ('axis', 4), ('diagonal', 2), ('string', 3), ('starts-one', [2, 3]), ('starts-one', [9]), ('mapping', 5, ['z']), ('negative', -2.5), 'other', 'other')"}}
{"submissionId": "cmsw2qs96003quvp2bh55cis9", "title": "Submission 55CIS9", "payload": {"code": "def make_lambdas(values):\n plain = [lambda: v for v in values]\n bound = [lambda v=v: v for v in values]\n return plain, bound\n\n\ndef binding_run():\n plain, bound = make_lambdas([1, 2, 3])\n a = [f() for f in plain]\n b = [f() for f in bound]\n\n data = [1, 2, 3]\n gen = (x * 10 for x in data)\n data = [4, 5]\n c = list(gen)\n\n src = [1, 2, 3]\n gen2 = (x * 10 for x in src)\n src.append(4)\n d = list(gen2)\n\n factor = 2\n gen3 = (x * factor for x in [1, 2])\n factor = 100\n e = list(gen3)\n\n n = 0\n lst = [n for n in range(3)]\n f = (lst, n)\n\n total = 0\n for total in range(3):\n pass\n return (a, b, c, d, e, f, total)", "input": "binding_run()", "language": "Python", "predicted_output": "([3, 3, 3], [1, 2, 3], [10, 20, 30], [10, 20, 30, 40], [100, 200], ([0, 1, 2], 0), 2)"}}
{"submissionId": "cmsw2qs96003ruvp2gigql761", "title": "Submission GQL761", "payload": {"code": "def case_map_run():\n s = \"stra\u00dfe\"\n a = (s.upper(), len(s), len(s.upper()))\n b = (\"\u00df\".casefold(), \"\u00df\".upper().casefold(),\n \"\u00df\".casefold() == \"SS\".casefold())\n c = (\"\u0130\".lower(), len(\"\u0130\".lower()))\n d = (\"\u01c5\".title(), \"\u01c5\".upper(), \"\u01c5\".lower(), \"\u01c5\".capitalize())\n e = \"o'neill mcdonald\".title()\n f = (\"\ufb01\".upper(), len(\"\ufb01\".upper()), \"\ufb01\".capitalize())\n g = (\"\u01c4\".istitle(), \"\u01c5\".istitle(), \"\u01c6\".istitle())\n h = \"\u00df\".capitalize()\n return (a, b, c, d, e, f, g, h)", "input": "case_map_run()", "language": "Python", "predicted_output": "(('STRASSE', 6, 7), ('ss', 'ss', True), ('i\u0307', 2), ('\u01c5', '\u01c4', '\u01c6', '\u01c5'), \"O'Neill Mcdonald\", ('FI', 2, 'Fi'), (True, True, False), 'Ss')"}}
{"submissionId": "cmsw2qs96003suvp2cfhsp54b", "title": "Submission HSP54B", "payload": {"code": "import unicodedata\n\n\ndef normalize_run():\n nfc = chr(0x00E9)\n nfd = \"e\" + chr(0x0301)\n a = (len(nfc), len(nfd), nfc == nfd,\n unicodedata.normalize(\"NFC\", nfd) == nfc)\n b = (unicodedata.name(nfd[1]), unicodedata.combining(nfd[1]))\n c = ([hex(ord(ch)) for ch in unicodedata.normalize(\"NFKC\", chr(0xFB01))],\n [hex(ord(ch)) for ch in unicodedata.normalize(\"NFC\", chr(0xFB01))])\n d = ([hex(ord(ch)) for ch in unicodedata.normalize(\"NFKC\", chr(0x00BD))],\n len(unicodedata.normalize(\"NFC\", chr(0x00BD))))\n e = (chr(0x2460).isdigit(), chr(0x2460).isnumeric(),\n unicodedata.decimal(chr(0x0663)), unicodedata.numeric(chr(0x00BD)))\n ordered = sorted({nfc, nfd, unicodedata.normalize(\"NFC\", nfd)})\n f = [[hex(ord(ch)) for ch in item] for item in ordered]\n g = (chr(0x00C5) == chr(0x212B),\n unicodedata.normalize(\"NFC\", chr(0x212B)) == chr(0x00C5),\n unicodedata.normalize(\"NFD\", chr(0x00C5)) == \"A\" + chr(0x030A))\n return (a, b, c, d, e, f, g)", "input": "normalize_run()", "language": "Python", "predicted_output": "((1, 2, False, True), ('COMBINING ACUTE ACCENT', 230), (['0x66', '0x69'], ['0xfb01']), (['0x31', '0x2044', '0x32'], 1), (True, True, 3, 0.5), [['0x65', '0x301'], ['0xe9']], (False, True, True))"}}
{"submissionId": "cmsw2qs96003tuvp2rcaieoy1", "title": "Submission AIEOY1", "payload": {"code": "def view_algebra():\n d = {\"a\": 1, \"b\": 2, \"c\": 3}\n keys = d.keys()\n items = d.items()\n values = d.values()\n\n a = (sorted(keys & {\"b\", \"c\", \"z\"}), sorted(keys - {\"a\"}),\n sorted(keys ^ {\"a\", \"z\"}))\n d[\"e\"] = 5\n b = (sorted(keys), len(items))\n c = sorted(items & {(\"a\", 1), (\"b\", 99)})\n e = ({\"a\": 1}.keys() == {\"a\"}, {\"a\": 1}.values() == {\"a\": 1}.values())\n f = list(reversed(list(d)))\n g = (\"a\", 1) in items\n\n other = {\"x\": [1]}\n try:\n other.items() & {(\"x\", [1])}\n h = \"ok\"\n except TypeError:\n h = \"TypeError\"\n\n i = list(zip(d.keys(), d.values())) == list(d.items())\n j = sorted(values)\n try:\n values & {1}\n k = \"ok\"\n except TypeError:\n k = \"TypeError\"\n return (a, b, c, e, f, g, h, i, j, k)", "input": "view_algebra()", "language": "Python", "predicted_output": "((['b', 'c'], ['b', 'c'], ['b', 'c', 'z']), (['a', 'b', 'c', 'e'], 4), [('a', 1)], (True, False), ['e', 'c', 'b', 'a'], True, 'TypeError', True, [1, 2, 3, 5], 'TypeError')"}}
{"submissionId": "cmsw2qs96003uuvp2ge4813c2", "title": "Submission 4813C2", "payload": {"code": "def slice_surgery():\n a = list(range(8))\n a[::2] = [\"x\"] * 4\n r1 = list(a)\n try:\n a[::2] = [\"y\"] * 3\n r2 = \"ok\"\n except ValueError:\n r2 = \"ValueError\"\n\n b = list(range(6))\n b[1:4] = [\"p\"]\n r3 = list(b)\n\n c = list(range(8))\n del c[::3]\n r4 = list(c)\n\n d = list(range(5))\n d[5:9] = [\"tail\"]\n r5 = list(d)\n\n e = list(range(5))\n e[2:2] = [\"ins1\", \"ins2\"]\n r6 = list(e)\n\n f = list(range(5))\n f[::-1] = list(\"abcde\")\n r7 = list(f)\n\n g = [1, 2, 3]\n g[:] = \"xy\"\n r8 = list(g)\n\n h = list(range(6))\n r9 = (h[4:1:-1], h[-1:-4:-1], h[1:5:2])\n return (r1, r2, r3, r4, r5, r6, r7, r8, r9)", "input": "slice_surgery()", "language": "Python", "predicted_output": "(['x', 1, 'x', 3, 'x', 5, 'x', 7], 'ValueError', [0, 'p', 4, 5], [1, 2, 4, 5, 7], [0, 1, 2, 3, 4, 'tail'], [0, 1, 'ins1', 'ins2', 2, 3, 4], ['e', 'd', 'c', 'b', 'a'], ['x', 'y'], ([4, 3, 2], [5, 4, 3], [1, 3]))"}}
{"submissionId": "cmsw2qs96003vuvp27kijhswy", "title": "Submission IJHSWY", "payload": {"code": "import itertools\n\n\ndef stream_consume():\n src = iter(range(10))\n a = list(itertools.islice(src, 3))\n b = next(src)\n c = list(itertools.islice(src, 0, 4, 2))\n d = next(src)\n\n x, y = itertools.tee(iter(\"abcd\"))\n e = (next(x), next(x), \"\".join(y), \"\".join(x))\n\n counter = itertools.count(5, -2)\n f = list(itertools.takewhile(lambda n: n > 0, counter))\n g = next(counter)\n\n fresh = [(k, list(v)) for k, v in itertools.groupby(\"aabbba\")]\n stale = [(k, v) for k, v in itertools.groupby(\"aabbba\")]\n h = [(k, list(v)) for k, v in stale]\n return (a, b, c, d, e, f, g, fresh, h)", "input": "stream_consume()", "language": "Python", "predicted_output": "([0, 1, 2], 3, [4, 6], 8, ('a', 'b', 'abcd', 'cd'), [5, 3, 1], -3, [('a', ['a', 'a']), ('b', ['b', 'b', 'b']), ('a', ['a'])], [('a', []), ('b', []), ('a', [])])"}}
{"submissionId": "cmsw2qs96003wuvp29r7hjgco", "title": "Submission 7HJGCO", "payload": {"code": "def codec_run():\n s = \"caf\u00e9 \u2603\"\n a = (s.encode(\"ascii\", \"replace\"), s.encode(\"ascii\", \"ignore\"),\n s.encode(\"ascii\", \"backslashreplace\"))\n b = s.encode(\"ascii\", \"xmlcharrefreplace\")\n c = s.encode(\"latin-1\", \"backslashreplace\")\n\n raw = b\"valid \\xff\\xfe tail\"\n d = (raw.decode(\"utf-8\", \"replace\"), raw.decode(\"utf-8\", \"ignore\"),\n raw.decode(\"utf-8\", \"backslashreplace\"))\n escaped = raw.decode(\"utf-8\", \"surrogateescape\")\n e = (len(escaped), [hex(ord(ch)) for ch in escaped[6:8]])\n f = escaped.encode(\"utf-8\", \"surrogateescape\") == raw\n try:\n escaped.encode(\"utf-8\")\n g = \"ok\"\n except UnicodeEncodeError as exc:\n g = type(exc).__name__\n h = (\"\u00e9\".encode(\"utf-8\"), len(\"\u00e9\".encode(\"utf-8\")),\n \"\u00e9\".encode(\"utf-16-le\"))\n return (a, b, c, d, e, f, g, h)", "input": "codec_run()", "language": "Python", "predicted_output": "((b'caf? ?', b'caf ', b'caf\\\\xe9 \\\\u2603'), b'caf&#233; &#9731;', b'caf\\xe9 \\\\u2603', ('valid \ufffd\ufffd tail', 'valid tail', 'valid \\\\xff\\\\xfe tail'), (13, ['0xdcff', '0xdcfe']), True, 'UnicodeEncodeError', (b'\\xc3\\xa9', 2, b'\\xe9\\x00'))"}}
{"submissionId": "cmsw2qs96003xuvp20mkxm78q", "title": "Submission KXM78Q", "payload": {"code": "import functools\nfrom collections import OrderedDict\n\n\n@functools.singledispatch\ndef describe(value):\n return (\"generic\", type(value).__name__)\n\n\n@describe.register\ndef _(value: int):\n return (\"int\", value)\n\n\n@describe.register(bool)\ndef _(value):\n return (\"bool\", value)\n\n\n@describe.register(list)\ndef _(value):\n return (\"list\", len(value))\n\n\n@describe.register(dict)\ndef _(value):\n return (\"dict\", sorted(value))\n\n\n@functools.singledispatch\ndef kind(value):\n return \"generic\"\n\n\n@kind.register(int)\ndef _(value):\n return \"int\"\n\n\nclass MyList(list):\n pass\n\n\ndef dispatch_run():\n return (\n describe(3),\n describe(True),\n describe(MyList([1, 2])),\n describe(OrderedDict(a=1)),\n describe(3.5),\n sorted(t.__name__ for t in describe.registry),\n (kind(True), kind(2), kind(2.0)),\n )", "input": "dispatch_run()", "language": "Python", "predicted_output": "(('int', 3), ('bool', True), ('list', 2), ('dict', ['a']), ('generic', 'float'), ['bool', 'dict', 'int', 'list', 'object'], ('int', 'int', 'generic'))"}}
{"submissionId": "cmsw2qs96003yuvp2v8et66so", "title": "Submission ET66SO", "payload": {"code": "def sentinel_iter():\n seq = [3, 1, 4, 1, 5, 9]\n it = iter(seq)\n a = list(iter(lambda: next(it, None), None))\n\n counter = {\"n\": 0}\n\n def tick():\n counter[\"n\"] += 1\n return counter[\"n\"] * counter[\"n\"]\n\n b = list(iter(tick, 16))\n c = counter[\"n\"]\n d = next(iter([]), \"empty\")\n\n chunks = iter([b\"ab\", b\"cd\", b\"\"])\n e = list(iter(lambda: next(chunks), b\"\"))\n\n words = iter([\"x\", \"y\", \"stop\", \"z\"])\n f = list(iter(lambda: next(words), \"stop\"))\n g = next(words)\n\n it2 = iter(\"ab\")\n h = (next(it2), next(it2), next(it2, \"done\"), iter(it2) is it2)\n return (a, b, c, d, e, f, g, h)", "input": "sentinel_iter()", "language": "Python", "predicted_output": "([3, 1, 4, 1, 5, 9], [1, 4, 9], 4, 'empty', [b'ab', b'cd'], ['x', 'y'], 'z', ('a', 'b', 'done', True))"}}
{"submissionId": "cmsw2qs96003zuvp2a3f9tpfv", "title": "Submission F9TPFV", "payload": {"code": "def zip_drain():\n it = iter(range(7))\n a = list(zip(it, it, it))\n b = list(it)\n\n it2 = iter(\"abcdef\")\n pairs = list(zip(it2, it2))\n c = (pairs, list(it2))\n\n short = iter([1, 2, 3])\n other = iter([\"a\", \"b\"])\n d = list(zip(short, other))\n e = list(short)\n\n try:\n list(zip([1, 2, 3], [\"a\"], strict=True))\n f = \"ok\"\n except ValueError:\n f = \"ValueError\"\n\n return (a, b, c, d, e, f, list(zip(*[])), list(zip()),\n list(zip([1, 2], [3, 4], [5])))", "input": "zip_drain()", "language": "Python", "predicted_output": "([(0, 1, 2), (3, 4, 5)], [], ([('a', 'b'), ('c', 'd'), ('e', 'f')], []), [(1, 'a'), (2, 'b')], [], 'ValueError', [], [], [(1, 3, 5)])"}}
{"submissionId": "cmsw2qs960040uvp25ryyx656", "title": "Submission YYX656", "payload": {"code": "import copy\n\n\ndef cyclic_repr():\n a = [1, 2]\n a.append(a)\n r1 = repr(a)\n\n d = {\"k\": 1}\n d[\"self\"] = d\n r2 = repr(d)\n\n r3 = (a[2] is a, len(a))\n\n c = copy.deepcopy(a)\n r4 = (c is not a, c[2] is c, repr(c))\n\n t = ([1],)\n t[0].append(t)\n r5 = repr(t)\n\n s = [1]\n s.append([s])\n r6 = repr(s)\n\n nested = []\n nested.append([nested])\n r7 = repr(nested)\n\n shallow = copy.copy(a)\n r8 = (shallow[2] is a, repr(shallow))\n return (r1, r2, r3, r4, r5, r6, r7, r8)", "input": "cyclic_repr()", "language": "Python", "predicted_output": "('[1, 2, [...]]', \"{'k': 1, 'self': {...}}\", (True, 3), (True, True, '[1, 2, [...]]'), '([1, (...)],)', '[1, [[...]]]', '[[[...]]]', (True, '[1, 2, [1, 2, [...]]]'))"}}
{"submissionId": "cmswrsvaa007kuvp2tkyqv3nl", "title": "Submission YQV3NL", "payload": {"code": "from itertools import groupby\ndef group_lengths(words):\n words = sorted(words, key=len)\n return {length: list(group) for length, group in groupby(words, key=len)}", "input": "group_lengths(['a', 'bb', 'cc', 'ddd', 'e', 'ff'])", "language": "Python", "predicted_output": "{1: ['a', 'e'], 2: ['bb', 'cc', 'ff'], 3: ['ddd']}"}}
{"submissionId": "cmswrta8f007luvp2eco0fl0y", "title": "Submission O0FL0Y", "payload": {"code": "from itertools import permutations\ndef unique_arrangements(s):\n return sorted(set(''.join(p) for p in permutations(s)))", "input": "unique_arrangements('aab')", "language": "Python", "predicted_output": "['aab', 'aba', 'baa']"}}
{"submissionId": "cmswrta8f007nuvp2c4j3sdeg", "title": "Submission J3SDEG", "payload": {"code": "import operator\ndef apply_ops(a, b, ops):\n table = {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv}\n return [table[op](a, b) for op in ops]", "input": "apply_ops(10, 4, ['+', '-', '*', '/'])", "language": "Python", "predicted_output": "[14, 6, 40, 2.5]"}}
{"submissionId": "cmswrta8f007ouvp2ouorxbh5", "title": "Submission ORXBH5", "payload": {"code": "from dataclasses import dataclass, field\n\n@dataclass(order=True)\nclass Point:\n x: int\n y: int\n\n def manhattan(self):\n return abs(self.x) + abs(self.y)\n\ndef farthest(points):\n return max(points, key=lambda p: p.manhattan())", "input": "farthest([Point(1, 2), Point(-3, 1), Point(2, 2)])", "language": "Python", "predicted_output": "Point(x=-3, y=1)"}}
{"submissionId": "cmswrta8f007puvp2fmvj1luy", "title": "Submission VJ1LUY", "payload": {"code": "from enum import Enum, auto\n\nclass Direction(Enum):\n NORTH = auto()\n EAST = auto()\n SOUTH = auto()\n WEST = auto()\n\ndef turn_right(d):\n order = [Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST]\n idx = order.index(d)\n return order[(idx + 1) % 4]", "input": "turn_right(Direction.WEST)", "language": "Python", "predicted_output": "Direction.NORTH"}}
{"submissionId": "cmswrtj5p007ruvp21yxefhfo", "title": "Submission XEFHFO", "payload": {"code": "import textwrap\ndef wrap_and_count(text, width):\n lines = textwrap.wrap(text, width=width)\n return (len(lines), lines)", "input": "wrap_and_count('the quick brown fox jumps over the lazy dog', 12)", "language": "Python", "predicted_output": "(4, ['the quick', 'brown fox', 'jumps over', 'the lazy dog'])"}}
{"submissionId": "cmswrtj5p007suvp2jk990d3h", "title": "Submission 990D3H", "payload": {"code": "from decimal import Decimal, ROUND_HALF_UP\ndef price_with_tax(price_str, rate_str):\n price = Decimal(price_str)\n rate = Decimal(rate_str)\n total = price * (1 + rate)\n return str(total.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP))", "input": "price_with_tax('19.99', '0.0825')", "language": "Python", "predicted_output": "21.64"}}
{"submissionId": "cmswrtj5p007tuvp20r884nfq", "title": "Submission 884NFQ", "payload": {"code": "from fractions import Fraction\ndef sum_fractions(pairs):\n total = Fraction(0)\n for num, den in pairs:\n total += Fraction(num, den)\n return total", "input": "sum_fractions([(1, 3), (1, 6), (1, 2)])", "language": "Python", "predicted_output": "1"}}
{"submissionId": "cmswrtj5p007uuvp2dwtmyclc", "title": "Submission TMYCLC", "payload": {"code": "class Resource:\n def __init__(self, name):\n self.name = name\n self.log = []\n\n def __enter__(self):\n self.log.append(f\"open {self.name}\")\n return self\n\n def __exit__(self, exc_type, exc_val, exc_tb):\n self.log.append(f\"close {self.name}\")\n return True\n\ndef use_resource():\n r = Resource(\"db\")\n with r:\n r.log.append(\"working\")\n raise ValueError(\"boom\")\n return r.log", "input": "use_resource()", "language": "Python", "predicted_output": "['open db', 'working', 'close db']"}}
{"submissionId": "cmswrtqid007vuvp2rj1h11os", "title": "Submission 1H11OS", "payload": {"code": "class Circle:\n def __init__(self, radius):\n self._radius = radius\n\n @property\n def radius(self):\n return self._radius\n\n @radius.setter\n def radius(self, value):\n if value < 0:\n raise ValueError(\"radius must be non-negative\")\n self._radius = value\n\n @property\n def area(self):\n return round(3.14159 * self._radius ** 2, 2)\n\ndef resize_and_area(r, new_radius):\n c = Circle(r)\n c.radius = new_radius\n return c.area", "input": "resize_and_area(5, 3)", "language": "Python", "predicted_output": "28.27"}}
{"submissionId": "cmswrtqie007wuvp2lr0dkgcx", "title": "Submission 0DKGCX", "payload": {"code": "class A:\n def greet(self):\n return \"A\"\n\nclass B(A):\n def greet(self):\n return \"B->\" + super().greet()\n\nclass C(A):\n def greet(self):\n return \"C->\" + super().greet()\n\nclass D(B, C):\n def greet(self):\n return \"D->\" + super().greet()\n\ndef mro_greeting():\n return D().greet()", "input": "mro_greeting()", "language": "Python", "predicted_output": "D->B->C->A"}}
{"submissionId": "cmswrtqie007xuvp2eyji5guc", "title": "Submission JI5GUC", "payload": {"code": "from itertools import filterfalse\n\ndef partition_by_predicate(nums, pred):\n matches = list(filter(pred, nums))\n non_matches = list(filterfalse(pred, nums))\n return (matches, non_matches)", "input": "partition_by_predicate([1, 2, 3, 4, 5, 6, 7, 8], lambda n: n % 3 == 0)", "language": "Python", "predicted_output": "([3, 6], [1, 2, 4, 5, 7, 8])"}}
{"submissionId": "cmswrtqie007yuvp24oj7ep6a", "title": "Submission J7EP6A", "payload": {"code": "def first_and_rest(items):\n first, *rest = items\n *init, last = rest\n return (first, init, last)", "input": "first_and_rest([10, 20, 30, 40, 50])", "language": "Python", "predicted_output": "(10, [20, 30, 40], 50)"}}
{"submissionId": "cmswrtqie007zuvp2390lz77p", "title": "Submission 0LZ77P", "payload": {"code": "def make_multipliers():\n return [lambda x, i=i: x * i for i in range(4)]\n\ndef apply_all(x):\n fns = make_multipliers()\n return [f(x) for f in fns]", "input": "apply_all(3)", "language": "Python", "predicted_output": "[0, 3, 6, 9]"}}
{"submissionId": "cmswrtvsk0081uvp27q6b7rnj", "title": "Submission 6B7RNJ", "payload": {"code": "from functools import lru_cache\n\n@lru_cache(maxsize=None)\ndef digit_sum(n):\n if n < 10:\n return n\n return n % 10 + digit_sum(n // 10)\n\n@lru_cache(maxsize=None)\ndef repeated_digit_sum(n):\n while n >= 10:\n n = digit_sum(n)\n return n", "input": "repeated_digit_sum(9875)", "language": "Python", "predicted_output": "2"}}
{"submissionId": "cmswru6ev0084uvp2f34u6age", "title": "Submission 4U6AGE", "payload": {"code": "def all_ascending(nums):\n return all(a < b for a, b in zip(nums, nums[1:]))\n\ndef any_negative(nums):\n return any(n < 0 for n in nums)\n\ndef check_list(nums):\n return (all_ascending(nums), any_negative(nums))", "input": "check_list([1, 3, 5, 4, -2])", "language": "Python", "predicted_output": "(False, True)"}}
{"submissionId": "cmswruw3r0086uvp2xxkurg56", "title": "Submission KURG56", "payload": {"code": "import random\ndef deterministic_shuffle(items, seed):\n rng = random.Random(seed)\n items = list(items)\n rng.shuffle(items)\n return items", "input": "deterministic_shuffle([1, 2, 3, 4, 5], 42)", "language": "Python", "predicted_output": "[4, 2, 3, 5, 1]"}}
{"submissionId": "cmswzw85l00ctuvp2jwiq4hvp", "title": "Submission IQ4HVP", "payload": {"code": "def accumulate(pairs, store={}):\n for key, value in pairs:\n store.setdefault(key, []).append(value)\n return dict(store)", "input": "(accumulate([('a', 1), ('b', 2)]), accumulate([('a', 3)]))", "language": "Python", "predicted_output": "({'a': [1, 3], 'b': [2]}, {'a': [1, 3], 'b': [2]})"}}
{"submissionId": "cmswzw85l00cuuvp2deb6mh6t", "title": "Submission B6MH6T", "payload": {"code": "def normalize_ports(tokens):\n ports = []\n for token in tokens:\n try:\n ports.append(int(token))\n except ValueError:\n ports.append(-1)\n else:\n if ports[-1] > 1024:\n ports[-1] = 1024\n finally:\n if ports[-1] == 0:\n ports.pop()\n return ports", "input": "normalize_ports(['80', 'http', '65535', '0', '1024'])", "language": "Python", "predicted_output": "[80, -1, 1024, 1024]"}}
{"submissionId": "cmswzw85l00cvuvp2t7q436b8", "title": "Submission Q436B8", "payload": {"code": "from itertools import groupby\n\ndef collapse_runs(records):\n summary = []\n for level, group in groupby(records, key=lambda record: record['level']):\n summary.append((level, sum(1 for _ in group)))\n return summary", "input": "collapse_runs([{'level': 'INFO'}, {'level': 'INFO'}, {'level': 'WARN'}, {'level': 'INFO'}])", "language": "Python", "predicted_output": "[('INFO', 2), ('WARN', 1), ('INFO', 1)]"}}
{"submissionId": "cmswzw85l00cwuvp2o78uxhev", "title": "Submission 8UXHEV", "payload": {"code": "from datetime import datetime, timedelta\n\ndef window_labels(start, count, minutes):\n base = datetime.strptime(start, '%Y-%m-%d %H:%M')\n return [(base + timedelta(minutes=minutes * step)).strftime('%d/%H:%M') for step in range(count)]", "input": "window_labels('2026-02-28 23:20', 4, 25)", "language": "Python", "predicted_output": "['28/23:20', '28/23:45', '01/00:10', '01/00:35']"}}
{"submissionId": "cmswzw85l00cxuvp2gfqke4xn", "title": "Submission QKE4XN", "payload": {"code": "def competition_ranks(scores):\n ordered = sorted(scores.items(), key=lambda pair: (-pair[1], pair[0]))\n ranks = {}\n previous_score = None\n current_rank = 0\n for position, (name, score) in enumerate(ordered, start=1):\n if score != previous_score:\n current_rank = position\n previous_score = score\n ranks[name] = current_rank\n return ranks", "input": "competition_ranks({'ana': 90, 'bo': 95, 'cy': 90, 'di': 80})", "language": "Python", "predicted_output": "{'bo': 1, 'ana': 2, 'cy': 2, 'di': 4}"}}
{"submissionId": "cmsx35cwm0000x3p25q4cap3o", "title": "Submission 4CAP3O", "payload": {"code": "class SkipMultiples:\n def __init__(self, limit, n):\n self.limit = limit\n self.n = n\n self.current = 0\n def __iter__(self):\n return self\n def __next__(self):\n while self.current < self.limit:\n self.current += 1\n if self.current % self.n != 0:\n return self.current\n raise StopIteration\n\ndef collect(limit, n):\n return list(SkipMultiples(limit, n))", "input": "collect(15, 3)", "language": "Python", "predicted_output": "[1, 2, 4, 5, 7, 8, 10, 11, 13, 14]"}}
{"submissionId": "cmsx35cwm0002x3p2xv9ydh3o", "title": "Submission 9YDH3O", "payload": {"code": "class Shape:\n def area(self):\n raise NotImplementedError\n\nclass Rectangle(Shape):\n def __init__(self, w, h):\n self.w = w\n self.h = h\n def area(self):\n return self.w * self.h\n\nclass Circle(Shape):\n def __init__(self, r):\n self.r = r\n def area(self):\n return round(3.14159 * self.r * self.r, 2)\n\ndef total_area(shapes):\n return sum(s.area() for s in shapes)", "input": "total_area([Rectangle(3, 4), Circle(2), Rectangle(5, 5)])", "language": "Python", "predicted_output": "49.57"}}
{"submissionId": "cmsx35cwm0004x3p2se7oe3wm", "title": "Submission 7OE3WM", "payload": {"code": "from functools import reduce\n\ndef running_max_index(nums):\n def combine(acc, pair):\n idx, val = pair\n best_idx, best_val, results = acc\n if val > best_val:\n best_idx, best_val = idx, val\n results = results + [(best_idx, best_val)]\n return best_idx, best_val, results\n _, _, results = reduce(combine, enumerate(nums), (-1, float('-inf'), []))\n return results", "input": "running_max_index([3, 1, 4, 1, 5, 9, 2, 6])", "language": "Python", "predicted_output": "[(0, 3), (0, 3), (2, 4), (2, 4), (4, 5), (5, 9), (5, 9), (5, 9)]"}}
{"submissionId": "cmsx35cwm0006x3p2rst9h4qv", "title": "Submission T9H4QV", "payload": {"code": "class Version:\n def __init__(self, major, minor, patch):\n self.major = major\n self.minor = minor\n self.patch = patch\n def __eq__(self, other):\n return (self.major, self.minor, self.patch) == (other.major, other.minor, other.patch)\n def __lt__(self, other):\n return (self.major, self.minor, self.patch) < (other.major, other.minor, other.patch)\n def __repr__(self):\n return f'{self.major}.{self.minor}.{self.patch}'\n\ndef sort_versions(versions):\n return sorted(versions)", "input": "sort_versions([Version(1, 2, 0), Version(1, 10, 0), Version(1, 2, 3), Version(0, 9, 9)])", "language": "Python", "predicted_output": "[0.9.9, 1.2.0, 1.2.3, 1.10.0]"}}
{"submissionId": "cmsx35cwn0007x3p2jusawql0", "title": "Submission SAWQL0", "payload": {"code": "def safe_divider(pairs):\n for a, b in pairs:\n try:\n yield a / b\n except ZeroDivisionError:\n yield None\n\ndef run_divisions(pairs):\n return list(safe_divider(pairs))", "input": "run_divisions([(10, 2), (5, 0), (9, 3), (1, 0)])", "language": "Python", "predicted_output": "[5.0, None, 3.0, None]"}}
{"submissionId": "cmsx35cwn0008x3p2gbkl82fo", "title": "Submission KL82FO", "payload": {"code": "def slice_report(s):\n return {\n 'reverse': s[::-1],\n 'every_other': s[::2],\n 'middle': s[2:-2],\n 'oob_high': s[100:200],\n 'neg_step_range': s[8:2:-1],\n }", "input": "slice_report('abcdefghij')", "language": "Python", "predicted_output": "{'reverse': 'jihgfedcba', 'every_other': 'acegi', 'middle': 'cdefgh', 'oob_high': '', 'neg_step_range': 'ihgfed'}"}}
{"submissionId": "cmsx35cwn0009x3p2i1qo2kew", "title": "Submission QO2KEW", "payload": {"code": "class Node:\n def __init__(self, value, nxt=None):\n self.value = value\n self.nxt = nxt\n\ndef build_list(values):\n head = None\n for v in reversed(values):\n head = Node(v, head)\n return head\n\ndef reverse_recursive(node, prev=None):\n if node is None:\n return prev\n nxt = node.nxt\n node.nxt = prev\n return reverse_recursive(nxt, node)\n\ndef to_list(head):\n out = []\n while head is not None:\n out.append(head.value)\n head = head.nxt\n return out\n\ndef run_reverse(values):\n head = build_list(values)\n reversed_head = reverse_recursive(head)\n return to_list(reversed_head)", "input": "run_reverse([1, 2, 3, 4, 5])", "language": "Python", "predicted_output": "[5, 4, 3, 2, 1]"}}
{"submissionId": "cmsx36tfl000ax3p2e7c1vsqw", "title": "Submission C1VSQW", "payload": {"code": "def make_account(balance):\n history = []\n def deposit(amount):\n nonlocal balance\n balance += amount\n history.append(('deposit', amount, balance))\n return balance\n def withdraw(amount):\n nonlocal balance\n if amount > balance:\n history.append(('rejected', amount, balance))\n return None\n balance -= amount\n history.append(('withdraw', amount, balance))\n return balance\n def get_history():\n return history\n return deposit, withdraw, get_history", "input": "(lambda: (lambda d, w, h: (d(50), w(30), w(1000), d(10), h()))(*make_account(100)))()", "language": "Python", "predicted_output": "(150, 120, None, 130, [('deposit', 50, 150), ('withdraw', 30, 120), ('rejected', 1000, 120), ('deposit', 10, 130)])"}}
{"submissionId": "cmsx373zl000cx3p2drgjnea1", "title": "Submission GJNEA1", "payload": {"code": "def flatten(items):\n result = []\n for item in items:\n if isinstance(item, list):\n result.extend(flatten(item))\n else:\n result.append(item)\n return result", "input": "flatten([1, [2, 3, [4, [5, 6], 7]], 8, [], [9]])", "language": "Python", "predicted_output": "[1, 2, 3, 4, 5, 6, 7, 8, 9]"}}
{"submissionId": "cmsx374iy000dx3p2rdut569v", "title": "Submission UT569V", "payload": {"code": "def add_item(item, bucket=[]):\n bucket.append(item)\n return bucket\n\ndef run_trap():\n first = add_item(1)\n second = add_item(2)\n third = add_item(3, [])\n return first, second, third, first is second", "input": "run_trap()", "language": "Python", "predicted_output": "([1, 2], [1, 2], [3], True)"}}
{"submissionId": "cmsx375kr000gx3p2l779uvhz", "title": "Submission 79UVHZ", "payload": {"code": "def memoize(func):\n cache = {}\n calls = [0]\n def wrapper(n):\n calls[0] += 1\n if n not in cache:\n cache[n] = func(n)\n return cache[n]\n wrapper.calls = calls\n return wrapper\n\n@memoize\ndef fib(n):\n if n < 2:\n return n\n return fib(n - 1) + fib(n - 2)\n\ndef run_fib(n):\n result = fib(n)\n return result, fib.calls[0]", "input": "run_fib(10)", "language": "Python", "predicted_output": "(55, 19)"}}
{"submissionId": "cmsx38p48000hx3p2z4sklufy", "title": "Submission SKLUFY", "payload": {"code": "class InsufficientFundsError(Exception):\n pass\n\ndef process_payment(balance, amount):\n log = []\n try:\n if amount <= 0:\n raise ValueError(\"amount must be positive\")\n if amount > balance:\n raise InsufficientFundsError(f\"need {amount - balance} more\")\n balance -= amount\n except ValueError as e:\n log.append(f\"value_error:{e}\")\n except InsufficientFundsError as e:\n log.append(f\"insufficient:{e}\")\n else:\n log.append(f\"success:{balance}\")\n finally:\n log.append(\"done\")\n return log\n\ndef run_payments():\n return [process_payment(100, 50), process_payment(100, -5), process_payment(100, 500)]", "input": "run_payments()", "language": "Python", "predicted_output": "[['success:50', 'done'], ['value_error:amount must be positive', 'done'], ['insufficient:need 400 more', 'done']]"}}
{"submissionId": "cmsx38p48000jx3p2spzz8jpr", "title": "Submission ZZ8JPR", "payload": {"code": "class Suppress:\n def __init__(self, exc_type):\n self.exc_type = exc_type\n self.suppressed = False\n def __enter__(self):\n return self\n def __exit__(self, exc_type, exc_val, exc_tb):\n if exc_type is not None and issubclass(exc_type, self.exc_type):\n self.suppressed = True\n return True\n return False\n\ndef run_block(will_raise, exc_kind):\n s = Suppress(ValueError)\n with s:\n if will_raise:\n if exc_kind == 'value':\n raise ValueError('bad value')\n else:\n raise TypeError('bad type')\n return s.suppressed\n\ndef run_suppress_demo():\n return [run_block(True, 'value'), run_block(False, 'value')]", "input": "run_suppress_demo()", "language": "Python", "predicted_output": "[True, False]"}}
{"submissionId": "cmsxkh6jg00f7kup2eddnae88", "title": "Submission DNAE88", "payload": {"code": "def reconcile(events):\n stock = {}\n rejected = []\n for sku, delta in events:\n current = stock.get(sku, 0)\n if current + delta < 0:\n rejected.append((sku, delta, current))\n else:\n stock[sku] = current + delta\n return dict(sorted(stock.items())), rejected", "input": "reconcile([('A', 5), ('B', 2), ('A', -7), ('A', -2), ('C', -1)])", "language": "Python", "predicted_output": "({'A': 3, 'B': 2}, [('A', -7, 5), ('C', -1, 0)])"}}
{"submissionId": "cmsxkh6jg00f8kup2qnzeb2j0", "title": "Submission ZEB2J0", "payload": {"code": "from collections import deque\n\ndef rolling_windows(values, width):\n window = deque()\n total = 0\n result = []\n for value in values:\n window.append(value)\n total += value\n if len(window) > width:\n total -= window.popleft()\n if len(window) == width:\n result.append((window[0], window[-1], total))\n return result", "input": "rolling_windows([4, -1, 3, 7, -2], 3)", "language": "Python", "predicted_output": "[(4, 3, 6), (-1, 7, 9), (3, -2, 8)]"}}
{"submissionId": "cmsxkh6jh00f9kup2fdgtsmmt", "title": "Submission GTSMMT", "payload": {"code": "def coerce_rows(rows, schema):\n result = []\n errors = []\n for index, row in enumerate(rows):\n clean = {}\n for field, kind in schema.items():\n value = row.get(field)\n try:\n if kind == 'int':\n clean[field] = int(value)\n elif kind == 'float':\n clean[field] = round(float(value), 2)\n elif kind == 'bool':\n lowered = str(value).lower()\n if lowered not in ('yes', 'no'):\n raise ValueError\n clean[field] = lowered == 'yes'\n except (TypeError, ValueError):\n clean[field] = None\n errors.append((index, field, value))\n result.append(clean)\n return result, errors", "input": "coerce_rows([{'age': '30', 'score': '8.256', 'active': 'yes'}, {'age': 'x', 'score': 4, 'active': 'maybe'}, {'age': 0, 'score': None, 'active': 'no'}], {'age': 'int', 'score': 'float', 'active': 'bool'})", "language": "Python", "predicted_output": "([{'age': 30, 'score': 8.26, 'active': True}, {'age': None, 'score': 4.0, 'active': None}, {'age': 0, 'score': None, 'active': False}], [(1, 'age', 'x'), (1, 'active', 'maybe'), (2, 'score', None)])"}}
{"submissionId": "cmsxkh6jh00fakup2rs29u4sc", "title": "Submission 29U4SC", "payload": {"code": "def allocate(requests, capacities):\n remaining = capacities.copy()\n allocations = []\n for team, resource, amount in requests:\n available = remaining.get(resource, 0)\n granted = min(max(amount, 0), available)\n if granted:\n allocations.append((team, resource, granted))\n remaining[resource] = available - granted\n return allocations, dict(sorted(remaining.items()))", "input": "allocate([('red', 'cpu', 3), ('blue', 'cpu', 4), ('red', 'gpu', 2), ('green', 'ram', 1), ('blue', 'gpu', -1)], {'cpu': 5, 'gpu': 1})", "language": "Python", "predicted_output": "([('red', 'cpu', 3), ('blue', 'cpu', 2), ('red', 'gpu', 1)], {'cpu': 0, 'gpu': 0})"}}
{"submissionId": "cmsxkh6jh00fbkup2cqdur2dn", "title": "Submission DUR2DN", "payload": {"code": "def retry_summary(jobs, limit):\n summary = {}\n exhausted = []\n for name in sorted(jobs):\n attempts = 0\n succeeded = False\n for outcome in jobs[name][:limit]:\n attempts += 1\n if outcome:\n succeeded = True\n break\n summary[name] = (attempts, succeeded)\n if not succeeded:\n exhausted.append(name)\n return summary, exhausted", "input": "retry_summary({'sync': [False, True, True], 'backup': [False, False, True], 'email': [True]}, 2)", "language": "Python", "predicted_output": "({'backup': (2, False), 'email': (1, True), 'sync': (2, True)}, ['backup'])"}}
{"submissionId": "cmsxkh6jh00fckup23bczfrda", "title": "Submission CZFRDA", "payload": {"code": "def trace_aliases(mapping, names):\n result = {}\n for start in names:\n path = []\n node = start\n while node in mapping and node not in path:\n path.append(node)\n node = mapping[node]\n if node in path:\n cycle = path[path.index(node):]\n result[start] = ('cycle', tuple(cycle))\n else:\n result[start] = ('target', node)\n return result", "input": "trace_aliases({'api': 'service', 'service': 'v2', 'old': 'legacy', 'legacy': 'old'}, ['api', 'old', 'missing'])", "language": "Python", "predicted_output": "{'api': ('target', 'v2'), 'old': ('cycle', ('old', 'legacy')), 'missing': ('target', 'missing')}"}}
{"submissionId": "cmsxkh6jh00fdkup2g9iug9xn", "title": "Submission IUG9XN", "payload": {"code": "def settle(entries, overdraft_fee=5):\n balances = {}\n alerts = []\n for account, amount in entries:\n before = balances.get(account, 0)\n after = before + amount\n if amount < 0 and after < 0:\n after -= overdraft_fee\n alerts.append((account, before, amount, after))\n balances[account] = after\n return dict(sorted(balances.items())), alerts", "input": "settle([('A', 20), ('B', -3), ('A', -25), ('B', 10), ('A', 15)])", "language": "Python", "predicted_output": "({'A': 5, 'B': 2}, [('B', 0, -3, -8), ('A', 20, -25, -10)])"}}
{"submissionId": "cmsxkh6jh00fekup228aurw2t", "title": "Submission AURW2T", "payload": {"code": "def compact_bookings(bookings):\n merged = []\n for room, start, end in sorted(bookings):\n if merged and merged[-1][0] == room and start <= merged[-1][2]:\n old_room, old_start, old_end = merged[-1]\n merged[-1] = (old_room, old_start, max(old_end, end))\n else:\n merged.append((room, start, end))\n return merged", "input": "compact_bookings([('B', 5, 8), ('A', 1, 3), ('A', 3, 6), ('B', 1, 2), ('A', 8, 9), ('B', 7, 10)])", "language": "Python", "predicted_output": "[('A', 1, 6), ('A', 8, 9), ('B', 1, 2), ('B', 5, 10)]"}}
{"submissionId": "cmsxkh6jh00ffkup2y8txjicf", "title": "Submission TXJICF", "payload": {"code": "def session_durations(events):\n active = {}\n durations = {}\n anomalies = []\n for user, minute, action in events:\n if action == 'login':\n if user in active:\n anomalies.append((user, 'duplicate_login', minute))\n else:\n active[user] = minute\n elif action == 'logout':\n if user not in active:\n anomalies.append((user, 'orphan_logout', minute))\n else:\n durations.setdefault(user, []).append(minute - active.pop(user))\n return dict(sorted(durations.items())), anomalies, dict(sorted(active.items()))", "input": "session_durations([('ana', 2, 'login'), ('bo', 4, 'logout'), ('ana', 7, 'login'), ('ana', 12, 'logout'), ('bo', 15, 'login')])", "language": "Python", "predicted_output": "({'ana': [10]}, [('bo', 'orphan_logout', 4), ('ana', 'duplicate_login', 7)], {'bo': 15})"}}
{"submissionId": "cmsxkh6jh00fgkup2qxick56s", "title": "Submission ICK56S", "payload": {"code": "import copy\n\ndef apply_patches(document, patches):\n result = copy.deepcopy(document)\n applied = []\n rejected = []\n for path, value in patches:\n keys = path.split('.')\n current = result\n valid = True\n for key in keys[:-1]:\n if key not in current:\n current[key] = {}\n if not isinstance(current[key], dict):\n valid = False\n break\n current = current[key]\n if valid:\n current[keys[-1]] = value\n applied.append(path)\n else:\n rejected.append(path)\n return result, applied, rejected", "input": "apply_patches({'user': {'name': 'Mira'}, 'version': 2}, [('user.active', True), ('settings.theme', 'dark'), ('version.major', 3), ('user.name', 'M')])", "language": "Python", "predicted_output": "({'user': {'name': 'M', 'active': True}, 'version': 2, 'settings': {'theme': 'dark'}}, ['user.active', 'settings.theme', 'user.name'], ['version.major'])"}}